我在设置视图中的某些对象时遇到了一些问题。Android使用ScrollView和ImageView以外
我有2 EditText
和2 Button
,一个在另一个下面。而在屏幕的底部,我有一个ImageView
,我想呆在那里没有滚动。
问题
我有里面除了ImageView
的所有对象的ScrollView
,但最后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