我正在尝试使用带有文字的上半部屏幕可滚动但下半部分屏幕在视频中显示视频。我想滚动我的文本区域,但我的底部按钮和视频将无法滚动。 但我的代码不起作用。 我该怎么办?
我的代码在下面..
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:id="@+id/rel_btn_Check"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:background="@android:color/black"
android:layout_alignParentBottom="true" >
<Button
android:id="@+id/buttonCheck"
android:layout_width="50sp"
android:layout_height="50sp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:background="@drawable/round_button"
android:onClick="onClickSkip"
android:text="Check" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rel_video"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/rel_btn_Check"
android:background="@android:color/white" >
<VideoView
android:layout_width="fill_parent"
android:layout_centerHorizontal="true"
android:layout_height="fill_parent"
android:id="@+id/vv01"/>
</RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_above="@id/rel_video"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="100dip"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/relative_id"
android:background="@android:color/white">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:textSize="20dip"
android:text="@string/XYZ" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dip"
android:layout_marginRight="10dip"
android:layout_marginTop="35dp"
android:textSize="15dip"
android:text="XYZ" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
答案 0 :(得分:0)
要将屏幕分成两半,您可以使用LinearLayout
作为容器,将方向设置为垂直,并将2个孩子设置为layout_weight="1"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<!-- YOUR SCROLLING CONTENT HERE -->
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<!-- YOUR VIDEOVIEW HERE -->
</RelativeLayout>
</LinearLayout>
答案 1 :(得分:0)
您需要使用ScrollView作为父级,然后才能滚动整页。尝试ScrollView内的所有视图
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<VideoView
android:layout_width="fill_parent"
android:layout_centerHorizontal="true"
android:layout_height="fill_parent"
android:id="@+id/vv01"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/relative_id"
android:background="@android:color/white">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:textSize="20dip"
android:text="@string/XYZ" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dip"
android:layout_marginRight="10dip"
android:layout_marginTop="35dp"
android:textSize="15dip"
android:text="XYZ" />
</RelativeLayout>
</ScrollView>