android – ScrollView与RelativeLayout不能很好地配合

所以我有一个ScrollView作为我的布局中的最高级别…在我的ScrollView中我有一个包含其他视图的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 如何解决dialog弹出时无法捕捉Activity的back事件 在...
Android实现自定义带文字和图片的Button 在Android开发中经常...
Android 关于长按back键退出应用程序的实现最近在做一个Andr...
android自带的时间选择器只能精确到分,但是对于某些应用要求...