【问题标题】:Place view above Sliding drawer handle将视图放在滑动抽屉把手上方
【发布时间】:2021-07-15 10:05:34
【问题描述】:

我有一个带有滑动抽屉视图的应用程序。我的问题是,在抽屉活动布局中,我有一个列表视图,它到达滑动抽屉手柄所在的屏幕底部。所以无法看到列表中的最后一个元素,因为句柄与它重叠。 我该如何解决这个问题?

【问题讨论】:

    标签: android


    【解决方案1】:

    我通过在列表视图底部添加空间解决了这个问题

    通过以下步骤:

    1.在布局文件夹中创建space_fotter.xml

    space_fotter.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content"
     android:background="@color/color_appBackground">
    <ImageView
            android:gravity="center"
            android:src = "@drawable/bg_white"
            android:layout_width="10dp"
            android:layout_height="50dp"
            /> 
    </LinearLayout>
    

    @drawable/bg_white 只是我创建的一个小的白色 png 文件。

    2.从你的列表活动类中调用 space_fotter.xml

    View SpaceFotter = getLayoutInflater().inflate(R.layout.space_fotter, null);
    

    3.将其添加到您的列表视图中:

    private ListView lv;
    lv =(ListView)findViewById(android.R.id.list); 
    lv.addFooterView(SpaceFotter );
    

    【讨论】:

    • 简单的方法是添加 android:layout_marginBottom="50dp" 到列表视图
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多