2016-09-09 6 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:fillViewport

android:orientation="vertical" 
android:fillViewport="true" 
이있는 ScrollView가 뷰포트를 채우기 위해 그 내용을 스트레칭해야하는지 여부를 정의합니다.

참고

피 큰 하드 코딩 된 값을 설정합니다. 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를 사용해야합니다. –

관련 문제