Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/205.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 独立工具栏,如何用链接填充所有空间_Android_Toolbar - Fatal编程技术网

Android 独立工具栏,如何用链接填充所有空间

Android 独立工具栏,如何用链接填充所有空间,android,toolbar,Android,Toolbar,在我的应用程序中,我在顶部有一个作为ActionBar的工具栏,在底部有一个独立的工具栏。底部的工具栏在右侧显示两个链接和“操作”菜单,但在左侧留下很大的空间,可能是应用程序图像和标题的空间。我想使用更多的链接这个空间。我一直没能找到一个方法来做到这一点。我找到了这些填充选项,但它们没有影响任何更改 android:contentInsetStart="0dp" android:contentInsetLeft="0dp" app:contentInsetLeft="0d

在我的应用程序中,我在顶部有一个作为ActionBar的工具栏,在底部有一个独立的工具栏。底部的工具栏在右侧显示两个链接和“操作”菜单,但在左侧留下很大的空间,可能是应用程序图像和标题的空间。我想使用更多的链接这个空间。我一直没能找到一个方法来做到这一点。我找到了这些填充选项,但它们没有影响任何更改

    android:contentInsetStart="0dp"
    android:contentInsetLeft="0dp"
    app:contentInsetLeft="0dp"
    app:contentInsetStart="0dp"
下面是工具栏的xml

还有菜单

<item android:id="@+id/webview"
    android:title="@string/webview"
    HTMLSpyII:showAsAction="always|withText" />

<item android:id="@+id/jsoupview"
    android:title="@string/jsoupview"
    HTMLSpyII:showAsAction="always|withText" />

<item android:id="@+id/codeview"
    android:title="@string/codeview"
    HTMLSpyII:showAsAction="ifRoom|withText" />

<item android:id="@+id/connview"
    android:title="@string/Connectivity"
    HTMLSpyII:showAsAction="ifRoom|withText" />

<item android:id="@+id/ftpview"
    android:title="@string/ftpview"
    HTMLSpyII:showAsAction="ifRoom|withText" />



您应该能够膨胀自己的布局并在工具栏上进行设置。大概是这样的:

LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.custom_layout, null);
mToolbar.addView(view);

我发现这正是我需要的。。。
<item android:id="@+id/webview"
    android:title="@string/webview"
    HTMLSpyII:showAsAction="always|withText" />

<item android:id="@+id/jsoupview"
    android:title="@string/jsoupview"
    HTMLSpyII:showAsAction="always|withText" />

<item android:id="@+id/codeview"
    android:title="@string/codeview"
    HTMLSpyII:showAsAction="ifRoom|withText" />

<item android:id="@+id/connview"
    android:title="@string/Connectivity"
    HTMLSpyII:showAsAction="ifRoom|withText" />

<item android:id="@+id/ftpview"
    android:title="@string/ftpview"
    HTMLSpyII:showAsAction="ifRoom|withText" />
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.custom_layout, null);
mToolbar.addView(view);