大佬教程收集整理的这篇文章主要介绍了Appcompat工具栏“android:title”属性不起作用,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
import android.support.v7.widget.Toolbar; ... // Works fine Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.settitle("My title");
在布局xml中设置它不起作用:
<!-- Doesn't work --> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:BACkground="?attr/colorPriMary" android:minHeight="?attr/actionBarSize" android@R_889_6964@="@String/my_title"/>
值得注意的是,我正在使用AppCompat v7库并对Android sdk版本18进行测试.
Action Bar
docs解释这个最好.
<menu xmlns:android="http://scheR_820_11845@as.android.com/apk/res/android" xmlns:yourapp="http://scheR_820_11845@as.android.com/apk/res-auto" > <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android@R_889_6964@="@String/action_search" yourapp:showAsAction="ifRoom" /> ... </menu>
换句话说,您需要将android:title更改为yourCustomPrefix:title
<YourRootViewGroup xmlns:app="http://scheR_820_11845@as.android.com/apk/res/org.seeingpixels.photon" xmlns:android="http://scheR_820_11845@as.android.com/apk/res/android" ... > <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:BACkground="?attr/colorPriMary" android:minHeight="?attr/actionBarSize" app@R_889_6964@="@String/my_title" /> </YourRootViewGroup>
以上是大佬教程为你收集整理的Appcompat工具栏“android:title”属性不起作用全部内容,希望文章能够帮你解决Appcompat工具栏“android:title”属性不起作用所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。