9

मेरे पास एक ऐसा फॉर्म है जिसमें लगभग 12/13 फ़ील्ड हैं। मैंने एक बाधा लेआउट के अंदर Scrollview का उपयोग किया। नीचे एक्सएमएल लेआउट का पदानुक्रम है। समस्या यह है कि, यह केवल पहले शुरुआती 10 विचारों के लिए स्क्रॉल के बजाय नीचे स्क्रॉल नहीं करता है। अंतिम 3 फ़ील्ड छुपाए गए हैं क्योंकि दृश्य आगे स्क्रॉल नहीं करता है।बाधा लेआउट के अंदर स्क्रॉलव्यू पैरेंट बाधा के नीचे स्क्रॉल नहीं करता है

PARENT लेआउट

<android.support.constraint.ConstraintLayout 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:id="@+id/activity_register" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:focusableInTouchMode="true" 
android:orientation="vertical"> 

<!-- Textview and a button --> 

    <ScrollView 
    android:id="@+id/scrollView" 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="10dp" 
    android:layout_marginTop="10dp" 
    android:orientation="vertical" 
    android:overScrollMode="never" 
    android:scrollbars="none" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintTop_toBottomOf="@+id/view" 
    tools:layout_constraintBottom_creator="1" 
    tools:layout_constraintLeft_creator="1" 
    tools:layout_constraintRight_creator="1" 
    tools:layout_constraintTop_creator="1" 
    tools:layout_editor_absoluteX="0dp" 
    tools:layout_editor_absoluteY="0dp"> 


    <android.support.constraint.ConstraintLayout 
     android:id="@+id/constraintLayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 

       <!-- Child Views (12/13 views of the fields)--> 

    </android.support.constraint.ConstraintLayout> 

</ScrollView> 

</android.support.constraint.ConstraintLayout> 
+0

'स्क्रॉलव्यू'' से 'match_parent' के' android: layout_height' पैरामीटर को बदलने का प्रयास करें। – Ircover

+1

कोशिश की, फिर भी यह काम नहीं करता है। –

+0

अभिभावक से मेल खाने के लिए ऊंचाई सेट करें और अपने स्क्रॉलव्यू के लिए fillViewPort सच करें, या नेस्टेड स्क्रॉलव्यू –

उत्तर

11

यह लेआउट मेरे एप्लिकेशन में काम करता है। एंड्रॉयड: layout_height = "0dp" एप्लिकेशन: चाल scrollview में इन दो विशेषताओं को सेट करने के लिए है layout_constraintBottom_toBottomOf = "जनक"

मेरे ऐप से सरल लेआउट:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 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="match_parent" 
    android:theme="@style/ThemeOverlay.AppCompat.Light"> 

    <RelativeLayout 
     android:id="@+id/linear" 
     android:layout_width="0dp" 
     android:layout_height="56dp" 
     android:background="@color/title" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toTopOf="parent" /> 

    <ScrollView 
     android:layout_width="0dp" 
     android:layout_height="0dp" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toBottomOf="@id/linear"> 

     <android.support.constraint.ConstraintLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <TextView 
       android:id="@+id/titleView" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="8dp" 
       android:layout_marginStart="8dp" 
       android:text="@string/title" 
       android:textSize="14sp" 
       app:layout_constraintBaseline_toBaselineOf="@+id/title" 
       app:layout_constraintLeft_toLeftOf="parent" /> 

      <EditText 
       android:id="@+id/title" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_marginEnd="8dp" 
       android:layout_marginRight="8dp" 
       android:hint="toilet title" 
       android:inputType="text" 
       android:textColor="@android:color/holo_red_dark" 
       android:textSize="12sp" 
       app:layout_constraintLeft_toLeftOf="@+id/open_hour" 
       app:layout_constraintLeft_toRightOf="@+id/titleView" 
       app:layout_constraintRight_toRightOf="parent" 
       app:layout_constraintTop_toTopOf="parent" /> 
      ... 
      Other Views in ScrollView 
      ... 
     </android.support.constraint.ConstraintLayout> 
    </ScrollView> 
</android.support.constraint.ConstraintLayout> 
2

दो चरणों

पुस्तक देखने के लिए
  1. रखें लेआउट ऊंचाई शून्य
    android:layout_height="0dp"

  2. पुस्तक देखने के लिए एक बार फिर


    android:fillViewport="true"

0

scrollview (जैसे: app:layout_constraintBottom_toBottomOf="parent") के निचले स्थिर जोड़ने का प्रयास करें और एंड्रॉयड बदलने के लिए: android:layout_height="0dp"

1

को layout_height = "wrap_content" मेरे मामले NestedScrollView काम में ScrollView के बजाय। मेरे कामकाजी लेआउट का स्निपेट निम्नलिखित है:

<android.support.constraint.ConstraintLayout 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="match_parent"> 

    <!-- Some Views Here --> 

    <android.support.v4.widget.NestedScrollView 
     android:layout_width="0dp" 
     android:layout_height="0dp" 
     android:fillViewport="true" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toBottomOf="@+id/view"> 

     <android.support.constraint.ConstraintLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <!-- Some Views That can be Scrolled Here --> 

     </android.support.constraint.ConstraintLayout> 

    </android.support.v4.widget.NestedScrollView> 

</android.support.constraint.ConstraintLayout> 
संबंधित मुद्दे