我正在使用com.sothree.slidinguppanel.SlidingUpPanelLayout来设计我的片段。 我想在打开软件键盘时隐藏滑动面板,并在软键盘关闭时取消隐藏。 如何以编程方式执行此操作?
对于包含com.sothree.slidinguppanel.SlidingUpPanelLayout的片段的布局,我将代码编写为
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/prescription_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:gravity="bottom"
sothree:umanoDragView="@+id/dragView"
sothree:umanoOverlay="false"
sothree:umanoPanelHeight="150dp"
sothree:umanoParallaxOffset="150dp"
sothree:umanoScrollableView="@+id/list"
sothree:umanoShadowHeight="0dp">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="300dp"
android:focusable="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="280dp"
android:background="@android:color/transparent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:background="@android:color/transparent"
android:orientation="vertical">
</LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
</RelativeLayout>
</LinearLayout>
答案 0 :(得分:0)
我找到了解决方案。在Manifest文件中android:windowSoftInputMode =&#34; adjustNothing&#34;不适用于此视图。
但是当你使用LinearLayout包装这个d @ mn视图时,就像这里
一样<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<com.sothree.slidinguppanel.SlidingUpPanelLayout >
...
</com.sothree.slidinguppanel.SlidingUpPanelLayout >
</LinearLayout>
然后在Manifest文件属性中 机器人:windowSoftInputMode =&#34; adjustNothing&#34; 奇迹般有效。 并且面板未显示在软键盘的顶部。