Java android操作栏删除空间
我制作了一个定制的android actionbar,但当我在手机上测试它时,有一个空间。。。我怎样才能解决它。有一些代码和图像 custom_actionbar.xmlJava android操作栏删除空间,java,android-studio,android-layout,Java,Android Studio,Android Layout,我制作了一个定制的android actionbar,但当我在手机上测试它时,有一个空间。。。我怎样才能解决它。有一些代码和图像 custom_actionbar.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="match_parent"
android:gravity="center_vertical"
android:background="#FFFFFF">
<ImageView
android:id="@+id/iv_logo"
android:layout_width="139dp"
android:layout_height="23dp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:contentDescription="@string/actinobar_logo"
app:srcCompat="@drawable/black_logo" />
</LinearLayout>
结果图像:
使用工具栏而不是操作栏 使用下面的代码
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorAccent"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp">
<include layout="@layout/lay_toolbar" />
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorAccent"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp">
<include layout="@layout/lay_toolbar" />
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"