【发布时间】:2017-05-10 15:59:56
【问题描述】:
我用一些按钮做了一个简单的页脚,它显示得很好,但我只有一个问题,当键盘是visible 时它不应该出现。它应该保持向下并且键盘必须覆盖它。
这是我的布局文件-
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView2"
android:layout_above="@id/footerView">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Name"
android:id="@+id/textView40"
android:layout_weight="2"
android:paddingLeft="30dp"
android:textAlignment="gravity"
android:layout_gravity="center_vertical" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/ETNameSU"
android:hint="Daksh Agrawal"
android:layout_weight="1"
android:layout_marginRight="30dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/footerView"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/view_books"
android:layout_weight="1" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView2"
android:layout_weight="1"
android:src="@drawable/my_profile" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView3"
android:layout_weight="1"
android:src="@drawable/post_book" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView4"
android:layout_weight="1"
android:src="@drawable/chat" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView5"
android:layout_weight="1"
android:src="@drawable/top_donors" />
</LinearLayout>
【问题讨论】:
-
从清单中移除 adjustPan 或 adjustResize。
-
清单中没有adjustPan
-
发布您的整个 xml 布局
-
你为什么要创建不需要的滚动视图。删除它。
-
您可以在 Activity 中的 onCreate() 或片段中的 onCreateView() 中使用它 getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
标签: android xml android-layout android-softkeyboard