У меня возникли проблемы с настройкой некоторых объектов в представлении.Использование Android ScrollView и ImageView за пределами
У меня есть 2 EditText
и 2 Button
, один под другим. И внизу экрана у меня есть ImageView
, что я хочу остаться там без прокрутки.
Проблема
У меня есть ScrollView
со всеми объектами внутри кроме ImageView
, но последний Button
не показали, потому что изображение покрывает его.
Редактировать
Мой код:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<!-- Layout with Image set at the top of the view, outside ScrollView -->
<LinearLayout
android:id="@+id/linearLayoutLogoFactor_main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<ImageView
android:id="@+id/imageViewLogoFactor_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo"/>
</LinearLayout>
<ScrollView
android:id="@+id/scrollViewMain"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/linearLayoutLogoFactor_main"
android:layout_marginTop="7dp">
<RelativeLayout
android:id="@+id/relativeLayoutMain"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true">
<EditText
android:id="@+id/editTextLoginUsuario"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:hint="@string/login_usuario"
android:ems="10"
android:imeOptions="actionNext"
android:selectAllOnFocus="true" />
<EditText
android:id="@+id/editTextLoginPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/editTextLoginUsuario"
android:layout_marginTop="5dp"
android:hint="@string/login_password"
android:ems="10"
android:inputType="textPassword"
android:imeOptions="actionDone"
android:selectAllOnFocus="true" />
<CheckBox
android:id="@+id/checkBoxRecordarDatos"
android:button="@drawable/checkbox_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editTextLoginPassword"
android:layout_centerHorizontal="true"
android:layout_marginTop="2dp"
android:text="@string/login_recordar"
android:textSize="@dimen/textSize"
android:onClick="setCheckBoxValue" />
<LinearLayout
android:id="@+id/linearLayoutEntrar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/checkBoxRecordarDatos"
android:gravity="center"
android:layout_marginTop="7dp"
android:weightSum="1.0">
<Button
android:id="@+id/buttonEntrar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="@string/login_entrar"
android:textColor="@android:color/white"
android:textStyle="bold"
android:textSize="@dimen/textSize"
android:onClick="entrar" />
</LinearLayout>
<!-- Layout and Button which are not seen correctly, it is covered -->
<LinearLayout
android:id="@+id/linearLayoutJugar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/linearLayoutEntrar"
android:gravity="center"
android:layout_marginTop="7dp"
android:layout_marginBottom="30dp"
android:weightSum="1.0">
<Button
android:id="@+id/buttonJugar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="@string/login_jugar"
android:textColor="@android:color/white"
android:textStyle="bold"
android:textSize="@dimen/textSize"
android:onClick="jugar" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
<LinearLayout
android:id="@+id/linearLayoutImagenInferior_main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_alignParentBottom="true" >
<ImageView
android:id="@+id/imageViewImagenInferior_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/la_electrica_de_las_empresas"
android:adjustViewBounds="true"/>
</LinearLayout>
Так как я могу установить его правильно для просмотра последнего Button
, когда я прокручиваю до дна, не прикрываясь ImageView
?
использование линейной компоновки вместо относительного расположения, если поместить их в вертикальной линии – bogdan
Я думаю, что ваш план и ваше заявление не соответствует. Вы сказали, что scrollView имеет все объекты внутри него, кроме изображения. Но это не относится к вашему размещенному XML. –
Если я использую линейный макет, он говорит мне, что я ставил ориентацию, и я не хочу его указывать. – Lyd