2017-02-20 12 views
0

In meinem Code Scrollview funktioniert nicht. Wenn ich dieses Layout direkt aufruft, funktioniert scrollview gut. Aber wenn ich dieses Layout von einer anderen Ansicht aus anrufe, ist dieses Layout nicht scrollbar.Scrollview funktioniert nicht?

  <ScrollView     
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/scrollData" 
      android:layout_width="fill_parent" 
      android:layout_height="match_parent" 
      android:fillViewport="true" 
      android:background="#000"> 
      <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical" 
      android:background="@color/setting_back">   
      <LinearLayout 
      android:id="@+id/about" 
      android:layout_width="match_parent" 
      android:layout_height="70dip" 
      android:layout_marginTop="10dp" 
      android:background="@drawable/background_with_shadow"> 
     <TextView 
        android:id="@+id/star" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_vertical" 
        android:layout_marginLeft="10dip" 
        android:text="@string/fa_star" 
        android:textColor="#3a3a3a" 
        android:textSize="30sp"/> 
      <TextView 
        android:id="@+id/about_id" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textColor="#000000" 
        android:layout_gravity="center_vertical" 
        android:layout_marginLeft="10dip" 
        android:textSize="20sp" 
        android:text="About"/> 
      <LinearLayout 
       android:layout_width="0dip" 
       android:layout_weight="1" 
       android:layout_height="match_parent" 
       android:gravity="right" 
       android:layout_marginRight="10dp" 
       android:orientation="horizontal" > 
        <TextView 
          android:id="@+id/fa_angle_down_about" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_gravity="right" 
          android:text="@string/fa_angle_down" 
          android:textColor="#3a3a3a" 
          android:textSize="30sp"/> 
      </LinearLayout>   
     </LinearLayout> 
     <LinearLayout 
     android:id="@+id/slide_down_about" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="12dp" 
     android:layout_marginRight="12dp" 
     android:padding="10dp" 
     android:layout_gravity="center_horizontal" 
     android:background="#fff"> 
      <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textColor="#000000" 
        android:text="@string/about_content"/> 
      </LinearLayout> 
     <LinearLayout 
     android:id="@+id/feedback" 
     android:layout_width="match_parent" 
     android:layout_height="70dip" 
     android:background="@drawable/background_with_shadow"> 
      <TextView 
        android:id="@+id/bell" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_vertical" 
        android:layout_marginLeft="10dip" 
        android:text="@string/fa_feedback" 
        android:textColor="#3a3a3a" 
        android:textSize="30sp"/> 
      <TextView 
        android:id="@+id/feedback_id" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textColor="#000000" 
        android:layout_gravity="center_vertical" 
        android:layout_marginLeft="10dip" 
        android:textSize="20sp" 
        android:text="Feedback"/> 
      <LinearLayout 
       android:layout_width="0dip" 
       android:layout_weight="1" 
       android:layout_height="match_parent" 
       android:gravity="right" 
       android:layout_marginRight="10dp" 
       android:orientation="horizontal" > 
        <TextView 
          android:id="@+id/fa_angle_down_feedback" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_gravity="right" 
          android:text="@string/fa_angle_down" 
          android:textColor="#3a3a3a" 
          android:textSize="30sp"/> 
      </LinearLayout> 
     </LinearLayout> 
     <LinearLayout 
     android:id="@+id/slide_down_feedback" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="12dp" 
     android:layout_marginRight="12dp" 
     android:padding="10dp" 
     android:background="#fff"> 
      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:padding="10dp" 
       android:background="#DBDFE2" 
       android:orientation="vertical"> 
      <EditText 
        android:id="@+id/submitfeedback" 
        android:layout_width="match_parent" 
        android:layout_height="100dp" 
        android:layout_marginBottom="20dp" 
        android:layout_marginLeft="2dp" 
        android:layout_marginRight="20dp" 
        android:background="#fff" 
        android:gravity="top" 
        android:hint="Your feedback here..." 
        android:textColor="#000000" 
        android:textColorHint="#ccc" 
        /> 
      <Button 
        android:id="@+id/submit" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:textColor="#fff" 
        android:background="#de682c" 
        android:text="submit"/> 
      </LinearLayout> 
     </LinearLayout>   
     <LinearLayout 
     android:id="@+id/terms" 
     android:layout_width="match_parent" 
     android:layout_height="70dip" 
     android:background="@drawable/background_with_shadow"> 
      <TextView 
        android:id="@+id/comment" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_vertical" 
        android:layout_marginLeft="10dip" 
        android:text="@string/fa_terms" 
        android:textColor="#3a3a3a" 
        android:textSize="30sp"/> 
      <TextView 
        android:id="@+id/terms_id" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textColor="#000000" 
        android:layout_gravity="center_vertical" 
        android:layout_marginLeft="10dip" 
        android:textSize="20sp" 
        android:text="Terms of use"/> 
      <LinearLayout 
       android:layout_width="0dip" 
       android:layout_weight="1" 
       android:layout_height="match_parent" 
       android:gravity="right" 
       android:layout_marginRight="10dp" 
       android:orientation="horizontal" > 
        <TextView 
          android:id="@+id/fa_angle_down_terms" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_gravity="right" 
          android:text="@string/fa_angle_down" 
          android:textColor="#3a3a3a" 
          android:textSize="30sp"/> 
      </LinearLayout> 
     </LinearLayout> 
     <LinearLayout 
     android:id="@+id/slide_down_terms" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="12dp" 
     android:layout_marginRight="12dp" 
     android:padding="10dp" 
     android:layout_gravity="center_horizontal" 

        android:background="#fff"> 

        <TextView  
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textColor="#000000" 
        android:text="@string/about_content"/> 
     </LinearLayout>  
     <LinearLayout 
     android:id="@+id/privacy_policy" 
     android:layout_width="match_parent" 
     android:layout_height="70dip" 
     android:background="@drawable/background_with_shadow"> 
      <TextView 
        android:id="@+id/license" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_vertical" 
        android:layout_marginLeft="10dip" 
        android:text="@string/fa_policy" 
        android:textColor="#3a3a3a" 
        android:textSize="30sp"/> 
      <TextView 
        android:id="@+id/policy_id" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textColor="#000000" 
        android:layout_gravity="center_vertical" 
        android:layout_marginLeft="10dip" 
        android:textSize="20sp" 
        android:text="Privacy Policy"/> 
      <LinearLayout 
       android:layout_width="0dip" 
       android:layout_weight="1" 
       android:layout_height="match_parent" 
       android:gravity="right" 
       android:layout_marginRight="10dp" 
       android:orientation="horizontal" > 
        <TextView 
          android:id="@+id/fa_angle_right_down_policy" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_gravity="right" 
          android:text="@string/fa_angle_down" 
          android:textColor="#3a3a3a" 
          android:textSize="30sp"/> 
      </LinearLayout> 
     </LinearLayout> 
     <LinearLayout 
     android:id="@+id/slide_down_policy" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="12dp" 
     android:layout_marginRight="12dp" 
     android:padding="10dp" 
     android:layout_gravity="center_horizontal" 
     android:background="#fff"> 
      <TextView   
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textColor="#000000" 
        android:text="@string/about_content"/> 
     </LinearLayout>  
</LinearLayout> 
</ScrollView> 

Ich versuchte alle Lösung von Stackoverflow.

+0

was meinst du mit direkt und mit einem anderen Layout –

+0

@ AdityaVyas-Lakhan , wie rufst du aus einer anderen Sichtweise an? Verwenden Sie '' – Tasneem

+0

@Tasneem ich rufe nicht: D –

Antwort

2

Wo ist das schließende Tag von scrollView? vielleicht wegen dieser Scroll nicht

+0

schließen Tag ist da. – Mhandroid

0

Versuchen Sie, diese Arbeit,

<?xml version="1.0" encoding="utf-8"?> 
    <ScrollView 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/scrollData" 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" 
     android:fillViewport="true" 
     android:background="#000" 
     android:focusableInTouchMode="true"> 
     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical" 
      android:background="@color/setting_back"> 
     <LinearLayout 
      android:id="@+id/about" 
      android:layout_width="match_parent" 
      android:layout_height="70dip" 
      android:layout_marginTop="10dp" 
      android:background="@drawable/background_with_shadow"> 
      <TextView 
       android:id="@+id/star" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_vertical" 
       android:layout_marginLeft="10dip" 
       android:text="@string/fa_star" 
       android:textColor="#3a3a3a" 
       android:textSize="30sp"/> 
      <TextView 
       android:id="@+id/about_id" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textColor="#000000" 
       android:layout_gravity="center_vertical" 
       android:layout_marginLeft="10dip" 
       android:textSize="20sp" 
       android:text="About"/> 
      <LinearLayout 
       android:layout_width="0dip" 
       android:layout_weight="1" 
       android:layout_height="match_parent" 
       android:gravity="right" 
       android:layout_marginRight="10dp" 
       android:orientation="horizontal" > 
       <TextView 
        android:id="@+id/fa_angle_down_about" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="right" 
        android:text="@string/fa_angle_down" 
        android:textColor="#3a3a3a" 
        android:textSize="30sp"/> 
      </LinearLayout> 
     </LinearLayout> 
     <LinearLayout 
      android:id="@+id/slide_down_about" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="12dp" 
      android:layout_marginRight="12dp" 
      android:padding="10dp" 
      android:layout_gravity="center_horizontal" 
      android:background="#fff"> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textColor="#000000" 
       android:text="@string/about_content"/> 
     </LinearLayout> 
     <LinearLayout 
      android:id="@+id/feedback" 
      android:layout_width="match_parent" 
      android:layout_height="70dip" 
      android:background="@drawable/background_with_shadow"> 
      <TextView 
       android:id="@+id/bell" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_vertical" 
       android:layout_marginLeft="10dip" 
       android:text="@string/fa_feedback" 
       android:textColor="#3a3a3a" 
       android:textSize="30sp"/> 
      <TextView 
       android:id="@+id/feedback_id" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textColor="#000000" 
       android:layout_gravity="center_vertical" 
       android:layout_marginLeft="10dip" 
       android:textSize="20sp" 
       android:text="Feedback"/> 
      <LinearLayout 
       android:layout_width="0dip" 
       android:layout_weight="1" 
       android:layout_height="match_parent" 
       android:gravity="right" 
       android:layout_marginRight="10dp" 
       android:orientation="horizontal" > 
       <TextView 
        android:id="@+id/fa_angle_down_feedback" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="right" 
        android:text="@string/fa_angle_down" 
        android:textColor="#3a3a3a" 
        android:textSize="30sp"/> 
      </LinearLayout> 
     </LinearLayout> 
     <LinearLayout 
      android:id="@+id/slide_down_feedback" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="12dp" 
      android:layout_marginRight="12dp" 
      android:padding="10dp" 
      android:background="#fff"> 
      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:padding="10dp" 
       android:background="#DBDFE2" 
       android:orientation="vertical"> 
       <EditText 
        android:id="@+id/submitfeedback" 
        android:layout_width="match_parent" 
        android:layout_height="100dp" 
        android:layout_marginBottom="20dp" 
        android:layout_marginLeft="2dp" 
        android:layout_marginRight="20dp" 
        android:background="#fff" 
        android:gravity="top" 
        android:hint="Your feedback here..." 
        android:textColor="#000000" 
        android:textColorHint="#ccc" 
        /> 
       <Button 
        android:id="@+id/submit" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:textColor="#fff" 
        android:background="#de682c" 
        android:text="submit"/> 
      </LinearLayout> 
     </LinearLayout> 
     <LinearLayout 
      android:id="@+id/terms" 
      android:layout_width="match_parent" 
      android:layout_height="70dip" 
      android:background="@drawable/background_with_shadow"> 
      <TextView 
       android:id="@+id/comment" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_vertical" 
       android:layout_marginLeft="10dip" 
       android:text="@string/fa_terms" 
       android:textColor="#3a3a3a" 
       android:textSize="30sp"/> 
      <TextView 
       android:id="@+id/terms_id" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textColor="#000000" 
       android:layout_gravity="center_vertical" 
       android:layout_marginLeft="10dip" 
       android:textSize="20sp" 
       android:text="Terms of use"/> 
      <LinearLayout 
       android:layout_width="0dip" 
       android:layout_weight="1" 
       android:layout_height="match_parent" 
       android:gravity="right" 
       android:layout_marginRight="10dp" 
       android:orientation="horizontal" > 
       <TextView 
        android:id="@+id/fa_angle_down_terms" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="right" 
        android:text="@string/fa_angle_down" 
        android:textColor="#3a3a3a" 
        android:textSize="30sp"/> 
      </LinearLayout> 
     </LinearLayout> 
     <LinearLayout 
      android:id="@+id/slide_down_terms" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="12dp" 
      android:layout_marginRight="12dp" 
      android:padding="10dp" 
      android:layout_gravity="center_horizontal" 

      android:background="#fff"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textColor="#000000" 
       android:text="@string/about_content"/> 
     </LinearLayout> 
     <LinearLayout 
      android:id="@+id/privacy_policy" 
      android:layout_width="match_parent" 
      android:layout_height="70dip" 
      android:background="@drawable/background_with_shadow"> 
      <TextView 
       android:id="@+id/license" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_vertical" 
       android:layout_marginLeft="10dip" 
       android:text="@string/fa_policy" 
       android:textColor="#3a3a3a" 
       android:textSize="30sp"/> 
      <TextView 
       android:id="@+id/policy_id" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textColor="#000000" 
       android:layout_gravity="center_vertical" 
       android:layout_marginLeft="10dip" 
       android:textSize="20sp" 
       android:text="Privacy Policy"/> 
      <LinearLayout 
       android:layout_width="0dip" 
       android:layout_weight="1" 
       android:layout_height="match_parent" 
       android:gravity="right" 
       android:layout_marginRight="10dp" 
       android:orientation="horizontal" > 
       <TextView 
        android:id="@+id/fa_angle_right_down_policy" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="right" 
        android:text="@string/fa_angle_down" 
        android:textColor="#3a3a3a" 
        android:textSize="30sp"/> 
      </LinearLayout> 
     </LinearLayout> 
     <LinearLayout 
      android:id="@+id/slide_down_policy" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="12dp" 
      android:layout_marginRight="12dp" 
      android:padding="10dp" 
      android:layout_gravity="center_horizontal" 
      android:background="#fff"> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textColor="#000000" 
       android:text="@string/about_content"/> 
     </LinearLayout> 
     </LinearLayout> 
    </ScrollView> 
+0

Es funktioniert nicht :( – Mhandroid

0

Sie sollten Ihr Layout zwischen ScrollView Tag legen, wenn Sie dieses Layout in einem anderen Layout inklusive sind. Das würde funktionieren.

in Ihrem anderen Layout:

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

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

</ScrollView> 
0

dies versuchen, machen ein Bündel wie diese scrollbaren .. zu bekommen

<ScrollView     
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/scrollData" 
    android:layout_width="fill_parent" 
    android:layout_height="match_parent" 
    android:fillViewport="true" 
    android:background="#000"> 

    <LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <!-- PUT YOUR CONTENT/ ELEMENT IN HERE --> 

    </LinearLayout> 
</ScrollView> 
+0

'LinearLayout' in' ScrollView' sollte 'android: layout_height =" wrap_content "' anstelle von 'match_parent' haben. Es sollte nicht ScrollViews Höhe entsprechen. Stattdessen hat es Höhe, die Summe der Höhen seiner Kinder ist - und sieht vor, dass die Höhe Scroll zu verstehen, wie blättern – krossovochkin

+0

sein Nein, nicht für mich arbeitet – Mhandroid

+0

leid - können Sie dies in Tag-Scroll hinzufügen:.. android: layout_width = „fill_parent“ android: layout_height = „fill_parent“ android : passtSystemWindows = "wahr" –

Verwandte Themen