模态底部,屏幕底部有广告
温馨提示:
本文最后更新于 2024年04月12日,已超过 48 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我。
我的Android应用程序具有以下结构:
<androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
/>
<androidx.coordinatorlayout.widget.CoordinatorLayout
app:layout_constraintBottom_toTopOf="@id/ll_ad_layout">
<!-- Application Content here-->
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
我想要的是底部模态表,将会打开,但仅限于上面的广告 - 因此它只能在中打开CoordinatorLayout
有人可以建议如何实现这个目标吗?我尝试创建模式,但它仅在整个活动中,打开因此它覆盖了广告。
模式 XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/modalBottomSheetContainer"
android:background="@android:color/white">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test"/>
</LinearLayout>
OnClick打开模式:
final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(MainActivity.this);
View bottomSheetView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.bottom_modal,
(LinearLayout) findViewById(R.id.modalBottomSheetContainer));
bottomSheetDialog.setContentView(bottomSheetView);
bottomSheetDialog.show();
非常感谢您帮助我解决这个问题,我相信您的建议会对很多人有所帮助。
正文到此结束
- 本文标签: 家庭宠物
- 本文链接: https://www.coder6.net/article/2416
- 版权声明: 本文由蚂蚁原创发布,转载请遵循《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权
热门推荐
-
浏览(192) 评论(0)