android - 如何防止元素隐藏在透明操作栏后面

标签 android xml android-layout android-actionbar

我的布局有问题。我在我的应用程序中使用 ViewPager 选项卡布局,我想使用透明操作栏。我设法防止元素隐藏在操作栏后面,但问题是元素仍然隐藏在选项卡栏后面。如何解决?

xml文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:paddingTop="?android:attr/actionBarSize"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical" 
    android:background="#E3F6CE">

    <ListView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    </ListView>


</LinearLayout>

最佳答案

使用 CoordinatorLayout 包装所有组件,并在你的 RelativeLayout 中使用此 app:layout_behavior="@string/appbar_scrolling_view_behavior",其中 xmlns:app="http://schemas.android.com/apk/res-auto"

关于android - 如何防止元素隐藏在透明操作栏后面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25330965/

相关文章:

android - 如何在Android中计算混响时间?

xml - 使用 XSL 在第一个位置插入 XML 节点

kotlin 中的 Android 应用程序不断崩溃

android - 如何解析维度字符串并将其转换为维度值

java - SHA1withRSA NoSuchAlgorithmException

android - 在 startIntentSenderForResult 之后未调用 OnActivityResult

android - 如何在不包含 android 支持库的情况下使用 ADT r20 创建 n 个项目?

c# - 检查 XML 节点是否具有 Linq C# 的属性?

html - 在 HTML 中表示剧本台词的语义方式

android - RecyclerView 未填充 android 中的剩余空间