Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/27.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_Android Actionbar_Titlebar - Fatal编程技术网

Android标题栏自定义视图不拉伸

Android标题栏自定义视图不拉伸,android,android-actionbar,titlebar,Android,Android Actionbar,Titlebar,我在我的应用程序中使用api 21标题栏。我想把我的钮扣或线条在上面伸展一下,但我做不到。 我的代码: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" an

我在我的应用程序中使用api 21标题栏。我想把我的钮扣或线条在上面伸展一下,但我做不到。 我的代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.toolbartest.MainActivity" >
<android.support.v7.widget.Toolbar  
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/my_awesome_toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="#ff9900"> 
<Button
    android:layout_height="match_parent"
android:layout_width="match_parent"
android:text="GSSGSDGSDG"/>
</android.support.v7.widget.Toolbar>

</LinearLayout>![enter image description here][1]


Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
我明白了:


我解决了它,这里是xml代码:

<android.support.v7.widget.Toolbar
    xmlns:plugshare="http://schemas.android.com/apk/res-auto"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/my_awesome_toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#ff9900"
    android:minHeight="?attr/actionBarSize"
    app1:contentInsetStart="0dp" >

 <Button
   android:layout_width="match_parent"
   android:layout_height="?attr/actionBarSize"
   android:text="GGSSSDFSDFSFFSDF" /> 
</android.support.v7.widget.Toolbar>

可能有助于在开发人员设置中启用“显示布局边界”。