2017-01-12 27 views
2

我有一个注册表单,其中包含几个用于显示错误的TextEdits和TextViews。问题是,当键盘上,用户无法向下滚动到地板元件虽然这个属性被设置为在清单文件中的活动:当键盘打开时,Android中的滚动窗体不起作用

android:windowSoftInputMode="stateVisible|adjustPan" 




<?xml version="1.0" encoding="utf-8"?> 

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto"> 
    <com.nvanbenschoten.motion.ParallaxImageView 
     android:id="@+id/background_image" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:src="@drawable/dark" 
     /> 
    <View 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@drawable/trending_gradient_shape" /> 
    <ScrollView 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:fillViewport="true"> 
    <LinearLayout 
     android:animateLayoutChanges="true" 
     android:id="@+id/mainLayout" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/my_toolbar" 
      app:titleTextColor="@color/color_white" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="@null" 
      android:elevation="4dp" 
      android:theme="@style/ToolbarThemeWhite" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> 


     <de.hdodenhof.circleimageview.CircleImageView 
      android:id="@+id/ivUserPhoto" 
      android:layout_width="100dp" 
      android:layout_height="100dp" 
      android:layout_marginTop="10dp" 
      android:layout_marginBottom="@dimen/margin_between_fields" 
      android:layout_gravity="center" 
      android:src="@drawable/ic_user" 
      android:layout_centerVertical="true" 
      app:civ_border_color="@android:color/white" 
      app:civ_border_width="4dp"/> 

     <EditText 
      android:textColorHint="@color/color_white" 
      android:paddingLeft="15dp" 
      android:background="@drawable/normal_rounded_text_field" 
      android:layout_marginRight="@dimen/form_margin" 
      android:layout_marginLeft="@dimen/form_margin" 
      android:layout_width="match_parent" 
      android:layout_height="40dp" 
      android:hint="First Name" 
      android:textColor="@color/color_white" 
      android:textSize="@dimen/form_field_text_size" 
      android:id="@+id/first_name" 
      android:ems="10" 
      android:singleLine="true" 
      android:nextFocusDown="@+id/family_name" 
      android:nextFocusForward="@+id/family_name" 
       /> 
      <TextView 
       android:visibility="gone" 
       android:id="@+id/error_first_name" 
       android:textColor="@color/color_red_700" 
       android:text="error" 
       android:layout_width="match_parent" 
       android:layout_marginRight="@dimen/form_margin" 
       android:layout_marginLeft="@dimen/form_margin" 
       android:layout_height="20dp" /> 
     <LinearLayout 
      android:layout_marginBottom="@dimen/margin_between_fields" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 
     </LinearLayout> 

     <EditText 
      android:textColorHint="@color/color_white" 
      android:paddingLeft="15dp" 
      android:background="@drawable/normal_rounded_text_field" 
      android:layout_marginRight="@dimen/form_margin" 
      android:layout_marginLeft="@dimen/form_margin" 
      android:layout_width="match_parent" 
      android:layout_height="40dp" 
      android:hint="Family Name" 
      android:textColor="@color/color_white" 
      android:textSize="@dimen/form_field_text_size" 
      android:id="@+id/family_name" 
      android:ems="10" 
      android:singleLine="true" 
      android:nextFocusUp="@+id/first_name" 
      android:nextFocusDown="@+id/email" 
      android:nextFocusForward="@+id/email" 
      /> 
     <TextView 
      android:visibility="gone" 
      android:id="@+id/error_family_name" 
      android:textColor="@color/color_red_700" 
      android:text="error" 
      android:layout_width="match_parent" 
      android:layout_marginRight="@dimen/form_margin" 
      android:layout_marginLeft="@dimen/form_margin" 
      android:layout_height="20dp" /> 
     <LinearLayout 
      android:layout_marginBottom="@dimen/margin_between_fields" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 
     </LinearLayout> 







    <LinearLayout 
     android:layout_marginRight="@dimen/form_margin" 
     android:layout_marginLeft="@dimen/form_margin" 
     android:layout_marginBottom="@dimen/margin_between_fields" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 
     <com.foxtrapp.mysmallcommunity.ui.OnItemNotSelectedSpinner 
      android:layout_gravity="center" 
      android:background="@drawable/normal_rounded_text_field" 
      android:layout_width="match_parent" 
      android:layout_height="40dp" 
      android:id="@+id/gender" 
      android:popupBackground="@null" 
      android:entries="@array/gender"/> 
     <TextView 
      android:visibility="gone" 
      android:id="@+id/error_gender" 
      android:textColor="@color/color_red_700" 
      android:text="error" 
      android:layout_width="match_parent" 
      android:layout_height="20dp" /> 
    </LinearLayout> 


     <EditText 
      android:textColorHint="@color/color_white" 
      android:paddingLeft="15dp" 
      android:background="@drawable/normal_rounded_text_field" 
      android:layout_marginRight="@dimen/form_margin" 
      android:layout_marginLeft="@dimen/form_margin" 
      android:layout_width="match_parent" 
      android:layout_height="40dp" 
      android:hint="Email" 
      android:nextFocusUp="@+id/family_name" 
      android:textColor="@color/color_white" 
      android:textSize="@dimen/form_field_text_size" 
      android:id="@+id/email" 
      android:inputType="textEmailAddress" 
      android:ems="10" 
      android:singleLine="true" 
      android:nextFocusDown="@+id/password" 
      android:nextFocusForward="@+id/password" 
      /> 
     <TextView 
      android:visibility="gone" 
      android:id="@+id/error_email" 
      android:textColor="@color/color_red_700" 
      android:text="error" 
      android:layout_width="match_parent" 
      android:layout_marginRight="@dimen/form_margin" 
      android:layout_marginLeft="@dimen/form_margin" 
      android:layout_height="20dp" /> 
     <LinearLayout 
      android:layout_marginBottom="@dimen/margin_between_fields" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 
     </LinearLayout> 







     <EditText 
      android:textColorHint="@color/color_white" 
      android:paddingLeft="15dp" 
      android:background="@drawable/normal_rounded_text_field" 
      android:layout_marginRight="@dimen/form_margin" 
      android:layout_marginLeft="@dimen/form_margin" 
      android:layout_width="match_parent" 
      android:layout_height="40dp" 
      android:hint="Password" 
      android:textColor="@color/color_white" 
      android:textSize="@dimen/form_field_text_size" 
      android:id="@+id/password" 
      android:inputType="textPassword" 
      android:ems="10" 
      android:singleLine="true" 
      android:nextFocusUp="@+id/email" 
      android:nextFocusDown="@+id/confirm_password" 
      android:nextFocusForward="@+id/confirm_password" 
      /> 
     <TextView 
      android:visibility="gone" 
      android:id="@+id/error_password" 
      android:textColor="@color/color_red_700" 
      android:text="error" 
      android:layout_width="match_parent" 
      android:layout_marginRight="@dimen/form_margin" 
      android:layout_marginLeft="@dimen/form_margin" 
      android:layout_height="20dp" /> 
     <LinearLayout 
      android:layout_marginBottom="@dimen/margin_between_fields" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 
     </LinearLayout> 



     <EditText 
      android:textColorHint="@color/color_white" 
      android:paddingLeft="15dp" 
      android:background="@drawable/normal_rounded_text_field" 
      android:layout_marginRight="@dimen/form_margin" 
      android:layout_marginLeft="@dimen/form_margin" 
      android:layout_width="match_parent" 
      android:layout_height="40dp" 
      android:hint="Confirm Password" 
      android:textColor="@color/color_white" 
      android:textSize="@dimen/form_field_text_size" 
      android:id="@+id/confirm_password" 
      android:inputType="textPassword" 
      android:ems="10" 
      android:singleLine="true" 
      android:nextFocusUp="@+id/password" 
      /> 
     <TextView 
      android:visibility="gone" 
      android:id="@+id/error_confirm_password" 
      android:textColor="@color/color_red_700" 
      android:text="error" 
      android:layout_width="match_parent" 
      android:layout_marginRight="@dimen/form_margin" 
      android:layout_marginLeft="@dimen/form_margin" 
      android:layout_height="20dp" /> 
     <LinearLayout 
      android:layout_marginBottom="@dimen/margin_between_fields" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 
     </LinearLayout> 


     <Button 
      android:paddingLeft="15dp" 
      android:layout_width="match_parent" 
      android:layout_height="43dp" 
      android:background="@drawable/button_get_st" 
      android:layout_gravity="center" 
      android:layout_marginRight="@dimen/form_margin" 
      android:layout_marginLeft="@dimen/form_margin" 
      android:text="Sign Up" 
      android:textColor="#FFF" 
      android:textSize="@dimen/form_field_text_size" 
      android:id="@+id/confirm" 
      android:visibility="visible" /> 

    </LinearLayout> 
    </ScrollView> 
</FrameLayout> 

注:当我补充一点,文本编辑,没有任何额外的部分滚动完美,

回答

0

我找到了答案;我认为在全屏模式和滚动窗体之间存在矛盾。我不得不使用全屏代码来解决问题,即我从我的活动中删除了以下代码:

requestWindowFeature(Window.FEATURE_NO_TITLE); 
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
     WindowManager.LayoutParams.FLAG_FULLSCREEN); 
0
You can try 

<RelativeLayout> 
<ScrollView> 
<RelativeLayout> 
-------------------- 
Your EditText and other widget 
------------------- 
</RelativeLayout> 
</ScrollView> 
</RelativeLayout> 
+0

相同,没有区别 –

相关问题