2016-11-29 1 views
1

내 앱에 로그인 양식이 있습니다 (전자 메일은 EditText, 비밀번호는 버튼 아래에 있습니다). 전자 메일에 포커스가 있으면 키보드가 비밀번호를 숨기기 때문에 사용자를 원합니다. 키보드의 다음 버튼을 누르지 않고 손가락으로 스크롤 할 수 있습니다. 키보드가 보이면 내용 스크롤

그래서 나는 ScrollView을 추가하기로 결정하고 나는 내용이 아래로 정렬 할 때문에, 나는 ScrollView의 부모로 LinearLayout을 추가하고 Scrollview에 대한 중력 바닥을 추가했다.

레이아웃에 대한 XML 코드는 다음과 같습니다

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:background="@color/white" 
android:layout_width="match_parent" android:layout_height="match_parent"> 

<ScrollView 
    android:layout_gravity="bottom" 
    android:fillViewport="true" 
    android:layout_width="match_parent" android:layout_height="wrap_content"> 

     <EditText 
      android:id="@+id/et_name" android:textSize="@dimen/app_text_size_medium" android:textColorHint="@color/white" 
      android:hint="Enter email" android:inputType="text" 
      android:paddingTop="8dp" 
      android:imeOptions="actionNext" android:maxLines="1" 
      android:textColor="@color/white" android:alpha="0.5" 
      android:background="@android:color/transparent" 
      android:layout_width="match_parent" android:layout_height="wrap_content" /> 

     <EditText 
      android:id="@+id/et_password" android:textSize="@dimen/app_text_size_medium" 
      android:hint="@string/sign_in_password_hint" android:inputType="textPassword" android:textColorHint="@color/white" 
      android:textColor="@android:color/white" android:alpha="0.5" 
      android:background="@android:color/transparent" 
      android:imeOptions="actionDone" android:maxLines="1" 
      android:layout_weight="4" 
      android:layout_width="0dp" android:layout_height="wrap_content" /> 

     <Button 
      android:id="@+id/btn_signin_submit" 
      android:text="@string/sign_in_button" android:textColor="@color/white" android:textSize="@dimen/app_text_size_normal" 
      android:textAllCaps="false" 
      android:background="@drawable/selector_btn_sign_in" 
      android:layout_marginLeft="@dimen/spacing_large_app" android:layout_marginRight="@dimen/spacing_large_app" 
      android:layout_width="match_parent" android:layout_height="wrap_content" /> 


    </LinearLayout> 

</ScrollView> 

문제는 하나 글고 다음 레이아웃을 포커스를 얻었을 때 그냥 "깜박"키보드와 스크롤 위의 모든 내용이되지 않는 것입니다 전혀 일하는 것.

부드럽게 스크롤하는 방법에 대한 도움이 필요하십니까?

+0

임 확실하지 작동하지만 당신의 AndroidManifest.xml 내부의 활동 선언에이 속성을 추가하려고합니다 경우 :. android : windowSoftInputMode = "stateVisible | adjustResize" –

+0

답장을 보내 주셔서 감사합니다. 이미 내 매니페스트 파일 안에 있습니다. – Mes

+0

ScrollView가 그것을 제거하고 android를 추가하지 않습니다 : windowSoftInputMode = "stateVisible | adjustSpan" –

답변

0

스크롤 뷰에는 사용할 필요가 없습니다. mainfest 파일에서 사이드 액티비티 태그에이 줄을 추가하기 만하면됩니다. 안드로이드 : windowSoftInputMode = "adjustPan

0

랩 안에 다른있는 LinearLayout 안에있는 ScrollView의 모든 어린이

관련 문제