2016-09-09 4 views
0

私はアクティビティに対してこのレイアウトを持っていますが、スクロールしません。ソリューションを見つけるにはどうすればよいですか?Android ScrollViewがスクロールしない

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 

     android:layout_marginTop="?attr/actionBarSize"> 

     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="80dp" 
      android:orientation="vertical" 
      app:layout_behavior="@string/appbar_scrolling_view_behavior" 
      tools:context="com.gurkhatech.schoolmanagementteachers.classrooms.singleclass.students.studentsdetails.StudentDetailsActivity" 
      tools:showIn="@layout/activity_student_details"> 


      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_margin="10dp" 
       android:padding="10dp"> 

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

        <ImageView 
         android:id="@+id/image_student_in_content_student_details" 
         android:layout_width="100dp" 
         android:layout_height="100dp" 
         android:layout_gravity="center" 
         android:layout_marginTop="10dp" 

         android:src="@mipmap/ic_launcher" 


         /> 


        <TextView 
         android:id="@+id/student_name_in_student_details" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:fontFamily="sans-serif" 
         android:gravity="center" 
         android:text="" 
         android:textColor="@color/colorTeal" 


         android:textSize="16sp" /> 


        <TextView 
         android:id="@+id/student_class_in_content_student_details" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_margin="5dp" 
         android:fontFamily="sans-serif" 
         android:gravity="center" 
         android:text="" 
         android:textColor="@color/colorTeal" 
         android:textSize="16sp" /> 
       </LinearLayout> 


      </android.support.v7.widget.CardView> 


      <TextView 
       android:id="@+id/birthday_in_content_student_details" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_margin="10dp" 
       android:fontFamily="sans-serif-light" 
       android:gravity="center" 
       android:text="" 


       android:textSize="16sp" /> 


      <TextView 
       android:id="@+id/sex_in_content_student_details" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 

       android:fontFamily="sans-serif-light" 
       android:gravity="center" 
       android:text="" 

       android:textSize="16sp" /> 


      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:layout_margin="15dp" 
       android:orientation="horizontal" 
       android:weightSum="10"> 


      </LinearLayout> 

      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_margin="5dp" 
       android:padding="10dp"> 


       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:orientation="vertical" 
        android:padding="5dp"> 

        <TextView 
         android:id="@+id/blood_group_students_details" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:fontFamily="sans-serif-condensed" 
         android:gravity="center" 
         android:text="Blood Group" 
         android:textSize="16sp" 

         android:visibility="gone" /> 

        <TextView 
         android:id="@+id/address_students_details" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:fontFamily="sans-serif-light" 
         android:gravity="center" 
         android:text="" 

         android:textSize="16sp" /> 


        <TextView 
         android:id="@+id/email_in_content_students_details" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="10dp" 
         android:layout_weight="2" 
         android:fontFamily="sans-serif-light" 
         android:gravity="center" 

         android:text="" 
         android:textColor="@color/colorTeal" 
         android:textSize="16sp" /> 


        <TextView 
         android:id="@+id/phone_in_content_students_details" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="10dp" 
         android:layout_weight="2" 
         android:fontFamily="sans-serif-light" 
         android:gravity="center" 
         android:text="" 
         android:textColor="@color/colorTeal" 
         android:textSize="16sp" /> 


       </LinearLayout> 
      </android.support.v7.widget.CardView> 


     </LinearLayout> 

     <TextView 
      android:id="@+id/image_upload_student_details" 
      android:layout_width="match_parent" 
      android:layout_height="70dp" 
      android:text="@string/upload_image" 
      android:textColor="@android:color/white" 
      android:textSize="30sp" 
      android:gravity="center" 
      android:layout_alignParentBottom="true" 
      android:background="@color/primary" /> 
    </RelativeLayout> 

</ScrollView> 
+1

?オリエンテーション=「縦」 アンドロイド: – Pawanpreet

+1

codehighlightが誤って相対的なレイアウト – Gaurav

+1

Scrollviewとしてスクロールビューの追加fillViewport =「true」を' –

答えて

2

あなたのScrollView節でfillViewportを使用する必要があります。

android:orientation="vertical" 
android:fillViewport="true" 

android:fillViewport

scrollviewが ビューポートを埋めるために、その内容を伸ばす必要があるかどうかを定義します。大ハードコードされた値を設定する

FYI

は避けてください。あなたの視点でandroid:layout_marginBottom="80dp"

+1

その作業なしでも –

+0

私は自分のシステムでコードを試しました –

+1

ありがとう作品 – erluxman

0

あなたの更新されたコードは - スクロールビューでその作業

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:layout_marginTop="?attr/actionBarSize"> 

<ScrollView 
    android:id="@+id/scroll_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

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

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

      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_margin="10dp" 
       android:padding="10dp"> 

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

        <ImageView 
         android:id="@+id/image_student_in_content_student_details" 
         android:layout_width="100dp" 
         android:layout_height="100dp" 
         android:layout_gravity="center" 
         android:layout_marginTop="10dp" 
         android:src="@drawable/ic_launcher" /> 


        <TextView 
         android:id="@+id/student_name_in_student_details" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:fontFamily="sans-serif" 
         android:gravity="center" 
         android:text="" 
         android:textColor="@color/ans_post_time_color" 


         android:textSize="16sp" /> 


        <TextView 
         android:id="@+id/student_class_in_content_student_details" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_margin="5dp" 
         android:fontFamily="sans-serif" 
         android:gravity="center" 
         android:text="" 
         android:textColor="@color/ans_post_time_color" 
         android:textSize="16sp" /> 
       </LinearLayout> 


      </android.support.v7.widget.CardView> 


      <TextView 
       android:id="@+id/birthday_in_content_student_details" 
       android:layout_width="match_parent" 
       android:layout_height="300dp" 
       android:layout_margin="10dp" 
       android:fontFamily="sans-serif-light" 
       android:gravity="center" 
       android:text="sdf asdf asdf asdf asdf " 
       android:textSize="16sp" /> 

      <TextView 
       android:id="@+id/sex_in_content_student_details" 
       android:layout_width="match_parent" 
       android:layout_height="50dp" 
       android:fontFamily="sans-serif-light" 
       android:gravity="center" 
       android:text="" 

       android:textSize="16sp" /> 


      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:layout_margin="15dp" 
       android:orientation="horizontal" 
       android:weightSum="10"> 


      </LinearLayout> 

      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_margin="5dp" 
       android:padding="10dp"> 


       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:orientation="vertical" 
        android:padding="5dp"> 

        <TextView 
         android:id="@+id/blood_group_students_details" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:fontFamily="sans-serif-condensed" 
         android:gravity="center" 
         android:text="Blood Group" 
         android:textSize="16sp" 

         android:visibility="gone" /> 

        <TextView 
         android:id="@+id/address_students_details" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:fontFamily="sans-serif-light" 
         android:gravity="center" 
         android:text="" 

         android:textSize="16sp" /> 


        <TextView 
         android:id="@+id/email_in_content_students_details" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="10dp" 
         android:layout_weight="2" 
         android:fontFamily="sans-serif-light" 
         android:gravity="center" 

         android:text="" 
         android:textColor="@color/white" 
         android:textSize="16sp" /> 


        <TextView 
         android:id="@+id/phone_in_content_students_details" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="10dp" 
         android:layout_weight="2" 
         android:fontFamily="sans-serif-light" 
         android:gravity="center" 
         android:text="" 
         android:textColor="@color/white" 
         android:textSize="16sp" /> 


       </LinearLayout> 
      </android.support.v7.widget.CardView> 


     </LinearLayout> 

     <TextView 
      android:id="@+id/image_upload_student_details" 
      android:layout_width="match_parent" 
      android:layout_height="70dp" 
      android:layout_alignParentBottom="true" 
      android:background="@color/primary" 
      android:gravity="center" 
      android:text="Upload Image" 
      android:textColor="@android:color/white" 
      android:textSize="30sp" /> 
    </RelativeLayout> 
</ScrollView> 

+0

あなたは相対的な作業の後にScrollviewを使う必要があります。 –

関連する問題