2017-02-03 8 views
3

scrollview 내에서 TextInputLayout을 사용하고 있는데, 응용 프로그램에 올 때보기가 잘 보이지만 scrollview를 시작하면 스크롤보기가 시작되지만 원본보기도 아래에 표시됩니다. 스냅 샷을 첨부하여 문제를 알려주십시오.scrollview 내 TextInputLayout

when i come to the app

을하고 난 스크롤 시작하면 그것은 다음과 같습니다 : 내가 응용 프로그램에 올 때

그것은 다음과 같습니다

: 여기

when i start scrolling

내 코드입니다
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background = "@android:color/transparent" 

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

    <LinearLayout 
     android:id="@+id/attch_photo_ll" 
     android:layout_width="match_parent" 
     android:layout_height="40dp" 
     android:layout_margin="5dp" 
     android:background="#CBCFD3" 
     > 
     <Button 
      android:id="@+id/attach_photo_btn" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@null" 
      android:textStyle="bold" 
      android:textSize="@dimen/_13sdp" 
      android:inputType="textNoSuggestions" 
      android:paddingLeft="10dp" 
      android:textColor="@android:color/white" 
      android:text="Attach Photo" 
      /> 
    </LinearLayout> 
    <LinearLayout 
     android:id="@+id/photo_ll" 
     android:visibility="gone" 
     android:layout_width="@dimen/image_width" 
     android:layout_height="@dimen/image_height" 
     android:layout_margin="5dp" 
     android:layout_gravity="center" 
     android:gravity="center"> 
     <ImageView 
      android:id="@+id/photo_img" 
      android:adjustViewBounds="true" 
      android:layout_width="@dimen/image_width" 
      android:layout_height="@dimen/image_height" 
      android:scaleType="fitXY"/> 
    </LinearLayout> 

    <android.support.design.widget.TextInputLayout 
     android:id="@+id/input_layout_username" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <EditText 
      android:id="@+id/firstName" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="First Name" /> 

    </android.support.design.widget.TextInputLayout> 


    <android.support.design.widget.TextInputLayout 
     android:id="@+id/input_layout_lastName" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <EditText 
      android:id="@+id/lastName" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="Last Name" /> 

    </android.support.design.widget.TextInputLayout> 



    <android.support.design.widget.TextInputLayout 
     android:id="@+id/input_layout_mobile_one" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <EditText 
      android:id="@+id/mobile_one" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="Mobile 1" /> 

    </android.support.design.widget.TextInputLayout> 



    <android.support.design.widget.TextInputLayout 
     android:id="@+id/input_layout_mobile_two" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <EditText 
      android:id="@+id/mobile_two" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="Mobile 2 (Optional)" /> 

    </android.support.design.widget.TextInputLayout> 



    <android.support.design.widget.TextInputLayout 
     android:id="@+id/input_layout_email" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <EditText 
      android:id="@+id/email" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="Email" /> 

    </android.support.design.widget.TextInputLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="5dp" 
     android:layout_marginRight="5dp" 
     android:layout_marginTop="@dimen/_8sdp" 
     android:orientation="horizontal" 
     android:weightSum="3"> 

     <android.support.design.widget.TextInputLayout 
      android:layout_weight="1" 
      android:id="@+id/input_layout_aadhar_card" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <EditText 
       android:id="@+id/aadhar_card" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="Aadhar No." /> 

     </android.support.design.widget.TextInputLayout> 


     <android.support.design.widget.TextInputLayout 
      android:layout_weight="1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <EditText 
       android:id="@+id/aadhar_card1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"/> 

     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout 
      android:layout_weight="1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <EditText 
       android:id="@+id/aadhar_card2" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"/> 

     </android.support.design.widget.TextInputLayout> 


    </LinearLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="5dp" 
     android:layout_marginRight="5dp" 
     android:layout_marginTop="@dimen/_8sdp" 
     android:layout_marginBottom="@dimen/_8sdp" 
     android:orientation="horizontal" 
     android:weightSum="3"> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/input_layout_pancard" 
      android:layout_weight="1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <EditText 
       android:id="@+id/pancard" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="Pan Card No."/> 

     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/input_layout_pancard1" 
      android:layout_weight="1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <EditText 
       android:id="@+id/pancard1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"/> 

     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/input_layout_pancard2" 
      android:layout_weight="1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <EditText 
       android:id="@+id/pancard2" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"/> 

     </android.support.design.widget.TextInputLayout> 


    </LinearLayout> 
</LinearLayout> 
</ScrollView> 
+0

이 레이아웃을 대화 상자로 사용할 수 있습니까 ?? –

+0

배경을 linearlayout에서 제거하고 @AmitRanjan을 제거합니다. –

+0

android : background = "@android : color/transparent" –

답변

1

시도해보십시오.
EditText에서 힌트를 제거하고

<android.support.design.widget.TextInputLayout 
     android:id="@+id/input_layout_username" 
     android:layout_width="match_parent" 
     android:hint="First Name" 
     android:layout_height="wrap_content"> 

     <EditText 
      android:id="@+id/firstName" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

    </android.support.design.widget.TextInputLayout> 
+0

, 스크롤이 시작될 때 작동하지 않습니다.보기가 여전히 배경에 있으며 위의 동일한보기는 –

0

복사하여 기존의 문제와 레이아웃 파일을 다음 붙여주십시오가 해결되었다 예를 들어
레이아웃에 TextInputLayout에 힌트를 추가

<?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="match_parent" 
android:background="@android:color/transparent"> 

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

    <LinearLayout 
     android:id="@+id/attch_photo_ll" 
     android:layout_width="match_parent" 
     android:layout_height="40dp" 
     android:layout_margin="5dp" 
     android:background="#CBCFD3"> 

     <Button 
      android:id="@+id/attach_photo_btn" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@null" 
      android:inputType="textNoSuggestions" 
      android:paddingLeft="10dp" 
      android:text="Attach Photo" 
      android:textColor="@android:color/white" 
      android:textStyle="bold" /> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/photo_ll" 
     android:layout_width="@dimen/image_width" 
     android:layout_height="@dimen/image_height" 
     android:layout_gravity="center" 
     android:layout_margin="5dp" 
     android:gravity="center" 
     android:visibility="gone"> 

     <ImageView 
      android:id="@+id/photo_img" 
      android:layout_width="@dimen/image_width" 
      android:layout_height="@dimen/image_height" 
      android:adjustViewBounds="true" 

      android:scaleType="fitXY" /> 
    </LinearLayout> 

    <android.support.design.widget.TextInputLayout 
     android:id="@+id/input_layout_username" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="First Name"> 

     <EditText 
      android:id="@+id/firstName" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

    </android.support.design.widget.TextInputLayout> 


    <android.support.design.widget.TextInputLayout 
     android:id="@+id/input_layout_lastName" 
     android:layout_width="match_parent" 

     android:layout_height="wrap_content" 
     android:hint="Last Name"> 

     <EditText 
      android:id="@+id/lastName" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

    </android.support.design.widget.TextInputLayout> 


    <android.support.design.widget.TextInputLayout 
     android:id="@+id/input_layout_mobile_one" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="Mobile 1"> 

     <EditText 
      android:id="@+id/mobile_one" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

    </android.support.design.widget.TextInputLayout> 


    <android.support.design.widget.TextInputLayout 
     android:id="@+id/input_layout_mobile_two" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="Mobile 2 (Optional)"> 

     <EditText 
      android:id="@+id/mobile_two" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

    </android.support.design.widget.TextInputLayout> 


    <android.support.design.widget.TextInputLayout 
     android:id="@+id/input_layout_email" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="Email"> 

     <EditText 
      android:id="@+id/email" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

    </android.support.design.widget.TextInputLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="5dp" 
     android:layout_marginRight="5dp" 
     android:orientation="horizontal" 
     android:weightSum="3"> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/input_layout_aadhar_card" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:hint="Aadhar No."> 

      <EditText 
       android:id="@+id/aadhar_card" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" /> 

     </android.support.design.widget.TextInputLayout> 


     <android.support.design.widget.TextInputLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1"> 

      <EditText 
       android:id="@+id/aadhar_card1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" /> 

     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1"> 

      <EditText 
       android:id="@+id/aadhar_card2" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" /> 

     </android.support.design.widget.TextInputLayout> 


    </LinearLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="5dp" 
     android:layout_marginRight="5dp" 
     android:orientation="horizontal" 
     android:weightSum="3"> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/input_layout_pancard" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:hint="Pan Card No."> 

      <EditText 
       android:id="@+id/pancard" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" /> 

     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/input_layout_pancard1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1"> 

      <EditText 
       android:id="@+id/pancard1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" /> 

     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/input_layout_pancard2" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1"> 

      <EditText 
       android:id="@+id/pancard2" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" /> 

     </android.support.design.widget.TextInputLayout> 


    </LinearLayout> 
</LinearLayout> 

+0

입니다. 작동하지 않는, 두 스크린 샷을 신중하게 볼 때 스크롤을 시작하면 같은 뷰가 배경에 있고 같은 뷰가 맨 위에서 스크롤하는 이유는 무엇입니까? –

+0

저는이 뷰를 조각으로 가지고 있으며이 뷰를 액티비티에 추가합니다. –