Android:如何将listView与自定义actionBar的底部对齐?
我正在跟随,使Android:如何将listView与自定义actionBar的底部对齐?,android,listview,android-actionbar,alignment,Android,Listview,Android Actionbar,Alignment,我正在跟随,使操作栏浮动在活动内容的顶部,以便我的背景图像从屏幕的上边缘延伸,而不是在操作栏下。但是,现在我需要将我的列表视图与操作栏的底部对齐,因为match\u parent现在将列表视图与上边缘对齐 是否只有在xml中才能实现这一点?actionBar的id是什么,我可以在下面设置layout\u 我确信我可以得到/估计代码中操作栏的高度,从而相应地设置列表视图的顶部边距,但我希望有一个更优雅的解决方案。谢谢 列表视图活动xml: <?xml version="1.0" encod
操作栏
浮动在活动内容的顶部,以便我的背景图像从屏幕的上边缘延伸,而不是在操作栏
下。但是,现在我需要将我的列表视图
与操作栏
的底部对齐,因为match\u parent
现在将列表视图
与上边缘对齐
是否只有在xml
中才能实现这一点?actionBar
的id
是什么,我可以在下面设置layout\u
我确信我可以得到/估计代码中操作栏的高度,从而相应地设置列表视图的顶部边距,但我希望有一个更优雅的解决方案。谢谢
列表视图
活动xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_users"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@drawable/img_people_512"
android:id="@+id/usersImageView"
android:alpha="0.55"
android:contentDescription="@string/backgroundImage"
android:scaleType="centerCrop" />
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/userListView"
/>
</RelativeLayout>
只需将布局添加到列表视图中即可
android:layout_marginTop="?actionBarSize"
只需将布局添加到列表视图中即可
android:layout_marginTop="?actionBarSize"