所以我有一个 ScrollView 作为我布局中的最高级别...在我的 ScrollView 中,我有一个包含其他 View 的 RelativeLayout。问题是 RelativeLayout 没有像它应该的那样覆盖整个布局,它在大约一半的屏幕处被切断。它的宽度是屏幕的整个宽度,但 RelativeLayout 的高度停在 ImageView 底部的位置。这是我的布局代码:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@drawable/graybck">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/pPicture"
android:layout_width="200dip"
android:layout_height="300dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<TextView
android:id="@+id/pName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="29dp"
android:layout_toRightOf="@+id/pPicture"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/pBio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/pName"
android:layout_below="@+id/pName"
android:layout_marginTop="22dp"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/stats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/pName"
android:layout_marginRight="266dp"
android:text="Loading Stats..." />
</RelativeLayout>
</ScrollView>
非常感谢任何帮助!
最佳答案
<Scrollview>
<LinearLayout>
<RelativeLayout>
inner part here ...
</RelativeLayout>
</LinearLayout>
</Scrollview>
尝试使用类似的东西。
关于android - ScrollView 不能很好地与 RelativeLayout 一起玩,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14907794/