我想在應用程序中使用滾動視圖,但它不工作,滾動條不會出現和按鈕重疊,我使用
RelativeLayout
做到這一點,我試過其他方式,但它不起作用。Android的ScrollView不工作
有人知道我必須做什麼嗎?
下面是代碼:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="81dp"
android:layout_height="61dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:text="@string/Texto14"
android:id="@+id/buttonHomePerfilV"
android:textColor="#ffffff"
android:background="#333399"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
<Button
android:layout_width="291dp"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/buttonIDAmizadePerfilV"
android:layout_marginBottom="70dp"
android:text="@string/Texto15"
android:id="@+id/buttonIniciarConversaPerfilV"
android:textColor="#ffffff"
android:background="#333399"
android:layout_above="@+id/buttonIDAmizadePerfilV"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="291dp"
android:layout_height="wrap_content"
android:text="@string/Texto16"
android:id="@+id/buttonIDAmizadePerfilV"
android:layout_marginBottom="20dp"
android:textColor="#ffffff"
android:background="#333399"
android:layout_alignParentBottom="true"
android:layout_alignStart="@+id/buttonIniciarConversaPerfilV" />
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/imageViewPerfilV"
android:src="@drawable/ic_launcher"
android:layout_below="@+id/buttonHomePerfilV"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/Texto8"
android:id="@+id/textViewNomePerfilV"
android:layout_below="@+id/imageViewPerfilV"
android:layout_alignStart="@+id/buttonHomePerfilV" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/Texto9"
android:id="@+id/textViewCursoPerfilV"
android:layout_toEndOf="@+id/buttonHomePerfilV"
android:layout_centerVertical="true"
android:layout_alignStart="@+id/textViewNomePerfilV" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/Texto10"
android:id="@+id/textViewDataPerfilV"
android:layout_alignTop="@+id/textViewCursoPerfilV"
android:layout_marginTop="45dp"
android:layout_marginLeft="20dp"
android:layout_alignParentStart="true" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
採取'ScrollView'爲'Parent' – 2014-11-06 10:53:52
對不起,我不明白 – 2014-11-06 10:55:32
刪除主'RelativeLayout'並採取'ScrollView'作爲主要佈局 – 2014-11-06 10:56:52