导航栏与最后一个ListView项重叠(Android) [英] Navbar overlapping last ListView item (Android)
问题描述
我的问题类似于上面的图片
My problem is similar to above Image
我在Nexus设备中遇到此问题.我通过增加底部导航栏的高度从底部添加了边距.但是我的应用程序在平板电脑的底部显示了额外的利润.
I am getting this issue in Nexus Devices. I added margin from bottom by getting Bottom Navigation Bar height. But my application is showing extra margin from the bottom on a tablet.
我不想更改样式文件中的任何内容.
I do not want to change anything in my style file.
Code:-
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/clubhouse_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/clubhouse_toolbar_main"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
android:background="@android:color/holo_red_dark"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_scrollFlags="scroll|enterAlways">
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="@android:style/TextAppearance.Holo.Medium.Inverse"
android:gravity="center"
android:singleLine="true"
android:maxLines="1"
android:paddingLeft="2dp"
android:ellipsize="end"
android:textColor="@color/white"
/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<ImageView
android:id="@+id/iv_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_ab_arrowup"/>
<FrameLayout
android:id="@+id/drop_down_overlay_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:layout_marginTop="60dp"
android:fitsSystemWindows="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
此帧布局中的drop_down_overlay_container是显示片段的地方.
The drop_down_overlay_container in this framelayout is where I am showing my Fragment.
推荐答案
好,以下是问题,cardview匹配父级高度实际上是带有顶部栏的全屏高度.一个很简单的解决方法是添加:
Ok the problem is the following, the cardview match parent height is actually the full screen height with top bar. An very easy fix for this is to add:
android:layout_marginBottom="?attr/actionBarSize"
像这样:
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.jburg.empty.Main22Activity"
tools:showIn="@layout/activity_main22"
android:background="@color/colorAccent"/>
这可在我的模拟器nexus 10平板电脑上使用.让我知道这是否对您有帮助,否则我会继续搜索:)
This works on my emulator nexus 10 tablet. Let me know if this helps you otherwise I'll keep searching :)
这篇关于导航栏与最后一个ListView项重叠(Android)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!