猿问

如何缩小操作栏中上/下箭头和标题之间的间距?

我知道在此之前已经问过这个问题,我已经研究了解决方案。我想缩小箭头和标题之间的空间,下面的图像有太多的空间。

最受欢迎的解决方案是app:contentInsetStartWithNavigation="0dp"在工具栏中添加如下XML代码:


        <android.support.v7.widget.Toolbar

            android:id="@+id/toolbar"

            android:layout_width="match_parent"

            android:layout_height="50dp"

            android:theme="@style/CustomToolbarStyle"

            app:layout_collapseMode="pin"

            app:contentInsetStartWithNavigation="0dp"/>

当我这样做并运行我的应用程序时,我收到错误消息:


Error:(100) No resource identifier found for attribute 'contentInsetStartWithNavigation' in package 'com.packagename'

搜索该错误导致我尝试尝试解决方案,而不是像添加到我的XML:


            android:contentInsetStart="0dp"

            android:contentInsetLeft="0dp"

            android:contentInsetRight="0dp"

            android:contentInsetEnd="0dp"

            app:contentInsetLeft="0dp"

            app:contentInsetStart="0dp"

            app:contentInsetRight="0dp"

            app:contentInsetEnd="0dp"

但是当我加载我的应用程序时,箭头和标题之间的间距没有改变,仍然有很大的空间。


我正在使用CoordinatorLayout我的工具,XML但看不到为什么会有所不同。


另外,在我XML更换时


<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"


<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/lib/com.mypackage.name"

按照此解决方案:错误:在“ com.google.example”包main.xml中找不到属性“ adSize”的资源标识符


我仍然会收到错误消息。


这是java我的活动代码,位于onCreate:


Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

setSupportActionBar(toolbar);


//Show the arrow to go back

ActionBar actionbar = getSupportActionBar();

actionbar.setDisplayHomeAsUpEnabled(true);


//show the App title

actionbar.setTitle("Pop");


繁花如伊
浏览 198回答 2
2回答
随时随地看视频慕课网APP

相关分类

Java
我要回答