-1

J'ai 4 TextView dans mon Activity et j'utilise LinearLayout avec l'orientation verticale. Top TextView est une sorte d'en-tête (pas besoin de faire défiler) la prochaine est une sorte de description que je veux faire défiler. Le 3ème est encore un en-tête (aucun parchemin nécessaire) et le 4ème est une description (besoin de faire défiler). J'ai essayé mais seulement TextView (en-tête) et 2ème TextView (description) est montré à l'écran. La description est scrollable mais le problème est, les deux autres TextView sont cachés. Son genre de question idiote à poser mais je suis un peu coincé ici parce que je suis nouveau à android. Voici mon xml.Scrollview dans deux Linearlayouts?

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/list_view" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_marginTop="?android:attr/actionBarSize" 
android:orientation="vertical" 
android:padding="15dp" 

> 

<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="#d0f7c9" 
    android:orientation="vertical" 
    android:padding="10dp" 

    > 

    <TextView 
     android:id="@+id/tvTitle" 
     style="?android:attr/listSeparatorTextViewStyle" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:textColor="#ffffff" 
     android:textSize="20dp" /> 

</LinearLayout> 


<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:fillViewport="true"> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="#b3cff4" 
     android:orientation="vertical"> 

     <TextView 
      android:id="@+id/tvShow" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textColor="@color/black" 
      android:textSize="20dp" /> 
    </LinearLayout> 
</ScrollView> 


<TextView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="Program Output" 
    android:textColor="@color/black" 
    android:textSize="25dp" /> 


<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="#d2b3f4"> 

     <TextView 
      android:id="@+id/tvOutput" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textColor="#ffffff" 
      android:textSize="20dp" /> 

    </LinearLayout> 

</ScrollView> 

Répondre

0

Vous pouvez essayer comme ça,

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical" 
       android:weightSum="2"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:background="#d0f7c9" 
     android:orientation="vertical"> 

     <TextView 
      android:id="@+id/tvTitle" 
      style="?android:attr/listSeparatorTextViewStyle" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:text="Top Title" 
      android:textColor="#ffffff" 
      android:textSize="20dp"/> 

     <ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="#b3cff4"> 

      <TextView 
       android:id="@+id/tvShow" 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:textSize="20dp"/> 
     </ScrollView> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:orientation="vertical"> 

     <TextView 
      android:id="@+id/tvTitle1" 
      style="?android:attr/listSeparatorTextViewStyle" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:text="Seconf Title" 
      android:textColor="#ffffff" 
      android:textSize="20dp"/> 

     <ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="#b3cff4"> 

      <TextView 
       android:id="@+id/tvShow1" 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:textSize="20dp"/> 
     </ScrollView> 
    </LinearLayout> 

</LinearLayout> 
+0

Vous avez fait ma journée. Je vous remercie –

0

La façon dont je voudrais probablement faire est de créer deux mises en page. L'un étant le texte numéro 1 et 2. L'autre disposition étant 3 et 4. puis dans la première mise en page, inclure la seconde.

<include layout="@layout/layout2"/> 

Quelque chose comme ceci. UNE MISE EN PAGE

<linearlayout> 
<text view> 
<linearlayout> 
<scrollview> 
<textview> 
</scrollview> 
</linearlayout> 

<include layout="@layout/layout2"/> 

</linearlayout> 

DEUX AGENCEMENT

<linearlayout> 
    <text view> 
    <linearlayout> 
    <scrollview> 
    <textview> 
    </scrollview> 
    </linearlayout> 
    </linear layout>