Pergunta

I am trying to do that top half screen with text is with scrollable but bottom half screen show a video in videoview. I want to scroll my text area but my bottom button and video will not scrollable. But my code not works it. How can i do it?

My code is below..

<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>
Foi útil?

Solução

To split the screen into two even halves you can use a LinearLayout as the container, set orientation to vertical, and set the 2 children to have 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>

Outras dicas

You need to use ScrollView as parent then only you scroll full page. try all your views inside of 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>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top