2013-12-24 4 views
0

Обряд теперь, весь экран прокручивается.Android с прокруткой только для половины экрана

enter image description here

Я хотел бы установить часть B (см фото) только прокручивать то время Части A (видео часть) фиксируется. Ниже приведен мой кодовый ритуал. Пожалуйста помоги.

<LinearLayout --some code here--> 
    <ScrollView 
     --some code here--> 
     <LinearLayout 
       android:id="@+id/videoPlayer" 
       > 
      <VideoView 
        --some code here--/> 
      <MediaController 
        android:layout_width="fill_parent" 
        /> 
      <TextView 
        --some code /> 
      <TextView 
        --some code /> 
      <ImageView some code 
       </ImageView> 
      <RelativeLayout --some code here--> 

       <TextView 
         android:id="@+id/scarfPrice" 
         /> 
       <Button android:id="@+id/btnPurchase" 
         /> 
      </RelativeLayout> 
     </LinearLayout> 
    </ScrollView> 
</LinearLayout> 

ответ

1
<LinearLayout --some code 
     --some code here--> 
     <LinearLayout 
       android:id="@+id/videoPlayer" 
       > 
      <VideoView 
        --some code here--/> 
      <MediaController 
        android:layout_width="fill_parent" 
        /> 
      <ScrollView> 
       <LinearLayout> 
        <TextView 
          --some code /> 
        <TextView 
          --some code /> 
        <ImageView some code 
         </ImageView> 
        <RelativeLayout --some code here--> 

         <TextView 
           android:id="@+id/scarfPrice" 
           /> 
         <Button android:id="@+id/btnPurchase" 
           /> 
        </RelativeLayout> 
       </LinearLayout> 
      </ScrollView> 
     </LinearLayout> 
    </ScrollView> 
</LinearLayout> 

tldr: Только оберните часть контента в Scrollview, но так как Scrollview может иметь только одного ребенка, гнездо другой LinearLayout внутри Scrollview.

EDIT: Удалить оригинальный </ScrollView> и избыточного LinearLayout

<LinearLayout --some code 
     --some code here--> 
      > 
     <VideoView 
       android:id="@+id/videoPlayer" 
       --some code here--/> 
     <MediaController 
       android:layout_width="fill_parent" 
       /> 
     <ScrollView> 
      <LinearLayout> 
       <TextView 
         --some code /> 
       <TextView 
         --some code /> 
       <ImageView some code 
        </ImageView> 
       <RelativeLayout --some code here--> 

        <TextView 
          android:id="@+id/scarfPrice" 
          /> 
        <Button android:id="@+id/btnPurchase" 
          /> 
       </RelativeLayout> 
      </LinearLayout> 
     </ScrollView> 
    </LinearLayout> 
+0

Благодарим вас за ответ. Я решил это. : D – user2412351

0
<LinearLayout> 
    <LinearLayout android:layout_weight="2"> 
     <!-- Part A --> 
    </LinearLayout> 
    <ScrollView android:layout_weight="3"> 
     <LinearLayout> 
      <!-- Part B --> 
     </LinearLayout> 
    </ScrollView> 
</LinearLayout> 

Часть А будут занимать 2/5 экрана. Часть B займет 3/5 экрана, и только часть B будет прокручиваться.

Смежные вопросы