2016-11-05 15 views
0

에 힌트를 숨 깁니다 (미세 먹으 렴) : enter image description here안드로이드 TextInputLayout 초점

을 그럼, 아래의 EditText을 집중하고 사진 하나에서, 다음이 글고을 재조명 발생합니다 : enter image description here

힌트가 표시되지 않거나 잘못 표시됩니다 (스크롤보기에 따라 다름).

해결책의 일부 : Scrollview는 EditText에 중점을두고 있지만 둘러싸여있는 android.support.design.widget.TextInputLayout 요소에 집중하고 싶지 않습니다. 따라서 힌트가 표시되는지는 중요하지 않습니다.

수정 방법은 무엇입니까? 내 XML (EditTexts와 android.support.design.widget.TextInputLayout을 포함하는 일부은 LinearLayouts에 기본적으로있는 ScrollView) :

<ScrollView 
      android:layout_width="match_parent" 
      android:fadeScrollbars="false" 
      android:layout_height="wrap_content"> 

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

       <LinearLayout 
        android:layout_width="match_parent" 
        android:orientation="horizontal" 
        android:focusable="true" 
        android:focusableInTouchMode="true" 
        android:weightSum="9" 
        android:descendantFocusability="beforeDescendants" 
        android:layout_height="match_parent"> 

        <TextView 
         android:layout_width="0dp" 
         android:layout_weight="1" 
         android:text="1" 
         android:gravity="center" 
         android:layout_height="match_parent" /> 

        <android.support.design.widget.TextInputLayout 
         android:layout_width="0dp" 
         android:layout_height="match_parent" 
         android:layout_weight="4"> 

         <EditText 
          android:layout_width="match_parent" 
          android:layout_weight="1" 
          android:maxLines="1" 
          android:hint="hint1.1" 
          android:inputType="numberDecimal" 
          android:layout_height="match_parent" /> 

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

        <android.support.design.widget.TextInputLayout 
         android:layout_width="0dp" 
         android:layout_height="match_parent" 
         android:layout_weight="4"> 

         <EditText 
          android:layout_width="match_parent" 
          android:maxLines="1" 
          android:inputType="number" 
          android:hint="hint1.2" 
          android:layout_height="match_parent" /> 


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

       </LinearLayout> 
       <LinearLayout 
        android:layout_width="match_parent" 
        android:orientation="horizontal" 
        android:weightSum="9" 
        android:layout_height="match_parent"> 

        <TextView 
         android:layout_width="0dp" 
         android:layout_height="match_parent" 
         android:layout_weight="1" 
         android:text="2" 
         android:gravity="center"/> 

        <android.support.design.widget.TextInputLayout 
         android:layout_width="0dp" 
         android:layout_height="match_parent" 
         android:layout_weight="4"> 

         <EditText 
          android:layout_width="match_parent" 
          android:layout_weight="1" 
          android:maxLines="1" 
          android:hint="hint2.1" 
          android:inputType="numberDecimal" 
          android:layout_height="match_parent" /> 

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

        <android.support.design.widget.TextInputLayout 
         android:layout_width="0dp" 
         android:layout_height="match_parent" 
         android:layout_weight="4"> 

         <EditText 
          android:layout_width="match_parent" 
          android:layout_weight="1" 
          android:maxLines="1" 
          android:hint="hint2.2" 
          android:inputType="number" 
          android:layout_height="match_parent" /> 

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

       </LinearLayout> 
       <LinearLayout 
        android:layout_width="match_parent" 
        android:orientation="horizontal" 
        android:weightSum="9" 
        android:layout_height="match_parent"> 

        <TextView 
         android:layout_width="0dp" 
         android:layout_height="match_parent" 
         android:layout_weight="1" 
         android:gravity="center" 
         android:text="3"/> 

        <android.support.design.widget.TextInputLayout 
         android:layout_width="0dp" 
         android:layout_height="match_parent" 
         android:layout_weight="4"> 

         <EditText 
          android:layout_width="match_parent" 
          android:hint="hint3.1" 
          android:maxLines="1" 
          android:inputType="numberDecimal" 
          android:layout_height="match_parent" /> 

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

        <android.support.design.widget.TextInputLayout 
         android:layout_width="0dp" 
         android:layout_height="match_parent" 
         android:layout_weight="4"> 

         <EditText 
          android:layout_width="match_parent" 
          android:layout_weight="1" 
          android:hint="hint3.2" 
          android:maxLines="1" 
          android:inputType="number" 
          android:layout_height="match_parent" /> 

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

       </LinearLayout> 

      </LinearLayout> 

     </ScrollView> 
+0

나는 그것이 나타난다 고 생각하지만 사촌 스크롤 볼이 스크롤되는 것을 볼 수는 없다. –

+0

예. 스크롤 뷰를 제대로 스크롤 할 수있는 방법이 있습니까? – Christian

+1

이 코드를 시도 .. 'your_scrollview.post은 (새의 Runnable() { @Override 공공 무효 실행() { your_scrollview.smoothScrollTo (0, your_EditBox.getBottom()); } });' –

답변

3

사용하여 글고보기의 적절한 위치로 이동이 코드,

your_scrollview.post(new Runnable() { 
@Override 
public void run() { 
     your_scrollview.smoothScrollTo(0, your_EditBox.getBottom()); 
} 
});