PanelSwitchHelper
PanelSwitchHelper copied to clipboard
Activity中的Fragment使用控件,底部编辑框不显示
Androidx版本:否 PanelSwitchHelper版本:v1.3.13 手机型号: 红米 note7 手机系统版本: Android 9.0 问题描述:主页Activity多Fragment,底部显示tab栏场景,当控件位于Fragment中,控件(内容区域RecyclerView,下方输入框),显示出来的效果为recyclerView与底部tab栏衔接,下方输入框并未展示;输入框添加下边距后能够展示,但是点击输入框,软键盘与输入框中间有一段间距,可能是tab栏。
onGlobalLayout
请问,大佬解决了吗?我也遇到同样的问题。。。
请问你现在用的是什么版本,为了方便沟通,可以加入我们的交流群
请问解决了吗,遇到了同样的问题。谢谢。
请问解决了吗,遇到了同样的问题。谢谢。
你能上传个xml文件,我先看看这个场景的UI结构,然后看看怎么兼容
这个场景在主页面底部TAB导航栏+ViewPager2,在Fragment中使用确实会出现遮挡问题,目前找到一种取巧的方案(测试设备少,兼容性未知),实现如下:
代码: val mHelper = PanelSwitchHelper.Builder(this) .addKeyboardStateListener { onKeyboardChange { visible, _ -> binding.space.isVisible = !visible } }.build(false)
XML: <com.effective.android.panel.view.PanelSwitchLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" app:animationSpeed="standard" >
<com.effective.android.panel.view.content.RelativeContentContainer
android:layout_width="match_parent"
android:layout_height="match_parent"
app:edit_view="@id/testEdit">
<LinearLayout
android:id="@+id/bottomLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<EditText
android:id="@+id/testEdit"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginHorizontal="16dp"
android:gravity="center_vertical"
android:hint="请输入你想说的"
android:paddingHorizontal="16dp"
android:paddingVertical="0dp"
android:textSize="14dp"
/>
<!-- android:layout_height="50dp" 为Tab导航栏高度,自行更改
<View
android:id="@+id/space"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/testRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottomLayout"
/>
</com.effective.android.panel.view.content.RelativeContentContainer>
<com.effective.android.panel.view.panel.PanelContainer
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</com.effective.android.panel.view.panel.PanelContainer>
</com.effective.android.panel.view.PanelSwitchLayout>
看更新日志V1.5.5就支持ViewPager2了,但是我用的V1.5.7版本,文档和demo没找到库自带的处理方案。