PopupWindow需要设置边距
生活随笔
收集整理的這篇文章主要介紹了
PopupWindow需要设置边距
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
最近使用PopupWindow時(shí),遇到個(gè)問題,想在彈出PopupWindow非全屏顯示,要留有邊距左、右12dp
解決方案:在布局里設(shè)置,如
內(nèi)容全部在LinearLayout中,最外面再包一層,設(shè)置marginLeft和MarginRight
即
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:paddingLeft="12dp"android:paddingRight="12dp"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:background="@drawable/shape_corners_button"android:orientation="vertical">? ? ?實(shí)際內(nèi)容
? ? ?</LinearLayout>
</FrameLayout>
?
總結(jié)
以上是生活随笔為你收集整理的PopupWindow需要设置边距的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何调教ChatGpt 让它听话
- 下一篇: h5 移动开发 html页面跳转,ios