0
我是Android新手,需要一些帮助。在我的布局中,我有一个图像,可滚动的文本和按钮下方的文本,但滚动视图隐藏了按钮所在的相对布局。我尝试过线性布局,但问题仍然存在。这里是我的代码:滚动视图隐藏我的相对布局1
<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/houseofstark"
android:scaleType="centerCrop"
android:src="@drawable/coverart" />
<ScrollView
android:id="@+id/scrolly"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/imageView1"
android:paddingTop="8dp" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/lyrics"
android:paddingBottom="8dp"
android:text="@string/lyrics"
android:textAlignment="gravity"
android:textSize="18sp" />
</ScrollView>
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/scrolly" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginRight="8dp"
android:background="#444444"
android:onClick="openwp"
android:text="@string/hbowebpage"
android:textColor="#f9f5f5"
android:textStyle="bold" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/button1"
android:background="#3b5998"
android:onClick="openFB"
android:text="@string/facebookpage"
android:textColor="#ffffff"
android:textStyle="bold" />
</RelativeLayout>
高度正如我可以看到这里,在末尾的最后一行 –
有 RelativeLayout的>忘了一 RelativeLayout的>。应用程序运行没有错误,但没有按钮。整个relativelayout1被scrollview隐藏。它与android:layout_below =“@ id/scrolly”有关。如果我用android:layout_above =“@ id/scrolly”更改此行,那么按钮在scrollview上方可见。 –