Comments (8)
经过测试LinearLayout不会被挤压RelativeLayout就会被挤压,但是我的view必须是是盖在recyclerview上面并且居中的,请问有什么办法么?
from panelswitchhelper.
根布局是LinearLayout 就不会被挤压了,
<com.effective.android.panel.view.PanelSwitchLayout
android:id="@+id/panel_switch_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:animationSpeed="standard">
<!-- 内容区域 -->
<!-- edit_view 指定一个 EditText 用于输入 ,必须项-->
<!-- empty_view 指定用户点击该 ID 对应的 View 时实现面板或者输入法隐藏,非必须项 -->
<com.effective.android.panel.view.content.ContentRelativeContainer
android:id="@+id/content_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:relative_edit_view="@id/edit_text">
根布局是RelativeLayout,就一定会被挤压,但是recyclerview不会被挤压变形
<com.effective.android.panel.view.PanelSwitchLayout
android:id="@+id/panel_switch_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:animationSpeed="standard">
<!-- 内容区域 -->
<!-- edit_view 指定一个 EditText 用于输入 ,必须项-->
<!-- empty_view 指定用户点击该 ID 对应的 View 时实现面板或者输入法隐藏,非必须项 -->
<com.effective.android.panel.view.content.ContentRelativeContainer
android:id="@+id/content_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:relative_edit_view="@id/edit_text">
from panelswitchhelper.
contentCanScrollOutside 为true则不会挤压。 你的场景描述得很抽象。礼物是什么布局,贴一下你整体的布局我才能理解你布局是怎么写的。 @Alexxiaopang
from panelswitchhelper.
<com.effective.android.panel.view.PanelSwitchLayout
android:id="@+id/panel_switch_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:animationSpeed="standard">
<com.effective.android.panel.view.content.ContentRelativeContainer
android:id="@+id/content_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:relative_edit_view="@id/edit_text">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_chat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:itemCount="100"
tools:listitem="@layout/item_chat_text" />
<com.puffer.live.ui.widget.roundview.RoundTextView
android:id="@+id/tv_badge"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_above="@+id/bottom_action"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="5dp"
android:drawableRight="@mipmap/chatroom_newmessage_remind"
android:drawablePadding="5dp"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text=""
android:textColor="@color/colorWhite"
android:textSize="8sp"
android:visibility="gone"
app:rv_backgroundColor="#00B880"
app:rv_cornerRadius="10dp" />
<com.puffer.live.ui.tab_match.livedetail.chat.RealNameLinearLayout
android:id="@+id/bottom_action"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#ffffff"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center_vertical"
android:minHeight="50dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/emotion_btn"
android:layout_width="48dp"
android:layout_height="48dp"
android:scaleType="centerInside"
android:src="@drawable/selector_emotion_btn" />
<EditText
android:id="@+id/edit_text"
android:layout_width="0dp"
android:layout_height="36dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/linearlayout_background_circle_5_e5e5e5"
android:focusable="true"
android:focusableInTouchMode="true"
android:inputType="textMultiLine"
android:paddingLeft="7dp"
android:singleLine="false"
android:textSize="12sp" />
<com.sugar.sugarlibrary.widget.StateButton
android:id="@+id/bt_send"
android:layout_width="54dp"
android:layout_height="30dp"
android:layout_marginRight="11dp"
android:gravity="center"
android:text="发送"
android:textColor="#ffffff"
android:textSize="16sp"
android:visibility="gone"
app:normalBackgroundColor="@color/color0077FE"
app:normalTextColor="@color/colorWhite"
app:radius_new="4dp" />
<com.puffer.live.ui.widget.roundview.RoundTextView
android:id="@+id/tv_send"
android:layout_width="54dp"
android:layout_height="30dp"
android:layout_marginRight="11dp"
android:gravity="center"
android:text="发送"
android:textColor="#ffffff"
android:textSize="16sp"
android:visibility="visible"
app:rv_backgroundColor="@color/color0077FE"
app:rv_cornerRadius="4dp"
app:rv_isRippleEnable="true" />
</com.puffer.live.ui.tab_match.livedetail.chat.RealNameLinearLayout>
</com.effective.android.panel.view.content.ContentRelativeContainer>
<com.effective.android.panel.view.PanelContainer
android:id="@+id/panel_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.effective.android.panel.view.PanelView
android:id="@+id/panel_emotion"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:panel_layout="@layout/panel_emotion_layout"
app:panel_trigger="@id/emotion_btn" />
</com.effective.android.panel.view.PanelContainer>
</com.effective.android.panel.view.PanelSwitchLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:gravity="center"
android:text="礼物的视图,也只是一个view,希望被键盘盖住而已,相对于整个布局居中" />
from panelswitchhelper.
这个就是全部的布局,外层贴上来就没了,外层是一个RelativeLayout
想做的效果:键盘顶起来的时候是盖住居中的礼物视图(可看做一个textview),但是我用了两种办法,这个视图都会跟着键盘移动
这个是在viewpage的fragment的,activity就一个 固定高度的 RelativeLayout+tablayout+viewpage
from panelswitchhelper.
输入法的显示必定会引起 window 窗口的更改,这个是系统特性的。你的问题出在:你的礼物写死了居中根布局,而根布局会随着window变化而更改高度。假如你礼物不想被滑动,也是有办法的。假如在window变化前,你的应用界面是1920高度。变化之后是1120.假设输入法是800,你的礼物视图高度是 900,你在页面初始化之后,获取应用界面高度,然后计算你礼物在没有window变化的时候,marginTop的高度(1920-900)/2 =500,然后动态设置这个属性。就不会跟随window变化而变化。
from panelswitchhelper.
可以了,已经解决,因为布局变了,不能用android:layout_centerInParent等属性,我在代码里面动态设置marginTop,已经解决,谢谢!
from panelswitchhelper.
@Alexxiaopang 那就好
from panelswitchhelper.
Related Issues (20)
- 在Android 5、7、8上有crash,非必现 HOT 1
- config.compile_sdk_version = 31 时有没有试过功能正常吗 HOT 1
- 表情面板显示时 点击输入框,表情面板立即变空白 HOT 1
- dialogFragment有问题 HOT 2
- 貌似是Dialog中放了Fragment就会崩溃 HOT 2
- 推荐一个使用Android11新特性的软键盘遮挡/平滑动画解决方案
- [缺陷] 底部输入框文字过多时会遮挡消息列表 HOT 8
- Recycleview在最下面一屏的时候,把item滑动到倒数第二条的位置,直接点击表情按钮会发生回弹,表情界面会弹出再缩回 HOT 1
- Activity中的Fragment使用控件,底部编辑框不显示 HOT 2
- BadTokenException HOT 1
- 集成后吊起键盘报错空指针 HOT 2
- 最新的依赖地址为何下载不下来 HOT 2
- 聊天页面点击切换表情的按钮,recycleview的内容会上下乱跳 HOT 8
- 两个编辑框,焦点错乱 HOT 1
- 小米 11-Android 12 -聊天-输入框输入文字的情况下,切换输入法卡顿
- Keyboard problem on Backberry
- 无法调整表情面板的高度 HOT 2
- WindowInsetsAnimationCompat加一个标记可能更好一点 HOT 4
- 140版本升级152版本原有表情包的位置显示是透明的 HOT 3
- 如果输入框上面还有视图得话,列表偏移位置不准确 HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panelswitchhelper.