gpt4 book ai didi

android - 导航栏与最后一个 ListView 项目重叠(Android)

转载 作者:IT王子 更新时间:2023-10-28 23:36:59 26 4
gpt4 key购买 nike

enter image description here

我的问题与上图类似

我在 Nexus 设备中遇到了这个问题。我通过获取 底部导航栏 高度从底部添加边距。但是我的应用程序在平板电脑的底部显示了额外的边距。

我不想更改样式文件中的任何内容。

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 是我展示 Fragment 的地方。

最佳答案

好的,问题如下,cardview匹配父高度实际上是带有顶栏的全屏高度。一个非常简单的解决方法是添加:

    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 平板电脑。让我知道这是否对您有帮助,否则我会继续搜索:)

关于android - 导航栏与最后一个 ListView 项目重叠(Android),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36810873/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com