我在 LinearLayout 中有一个 ListView。我想在操作栏和 ListView 的第一项之间留出空间,例如 YouTube 应用程序:
为了得到这个结果,我尝试了填充和边距以便 LinearLayout 和 ListView,但是当用户滚动 ListView 时,项目应该超出 Actionbar 但是!正如您在我的结果图像中看到的那样,项目开始从顶部边缘开始消失! (空格是我为 ListView 或线性布局设置的填充或边距)
有没有人知道如何处理这个问题?
谢谢
最佳答案
你需要做的就是在listview上面的xml中添加一个textview。应如下所示:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.90" />
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="422dp" />
</LinearLayout>
关于android - ActionBar 和 ListView 行之间的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24402727/