Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.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
Java 自定义操作栏未显示_Java_Android - Fatal编程技术网

Java 自定义操作栏未显示

Java 自定义操作栏未显示,java,android,Java,Android,我是android开发的初学者。。 我不知道问题出在哪里 该活动不显示自定义操作栏。。。 我试着看了一个教程。。 请给出一些解决办法。。 提前谢谢 actoin_bar.xml ` 首先创建充气器和自定义视图,如下所示: LayoutInflater mInflater = LayoutInflater.from(this); View mCustomView = mInflater.inflate(R.layout.your_custom_actionbar_xml, null); Text

我是android开发的初学者。。 我不知道问题出在哪里

该活动不显示自定义操作栏。。。 我试着看了一个教程。。 请给出一些解决办法。。 提前谢谢

actoin_bar.xml

`


首先创建充气器和自定义视图,如下所示:

LayoutInflater mInflater = LayoutInflater.from(this);
View mCustomView = mInflater.inflate(R.layout.your_custom_actionbar_xml, null);

TextView mTitleTextView = (TextView) mCustomView.findViewById(R.id.title_text_small);
mTitleTextView.setText("Bla bla bla);

ImageView img = (ImageView) mCustomView.findViewById(R.id.forward);
//.... more view
然后为操作栏设置自定义视图:

mActionBar.setCustomView(mCustomView);

首先创建充气器和自定义视图,如下所示:

LayoutInflater mInflater = LayoutInflater.from(this);
View mCustomView = mInflater.inflate(R.layout.your_custom_actionbar_xml, null);

TextView mTitleTextView = (TextView) mCustomView.findViewById(R.id.title_text_small);
mTitleTextView.setText("Bla bla bla);

ImageView img = (ImageView) mCustomView.findViewById(R.id.forward);
//.... more view
然后为操作栏设置自定义视图:

mActionBar.setCustomView(mCustomView);

@sajolhossain您使用的主题是什么?theme.AppCompat.DayNight.noActionBar只要将其更改为其他主题,它就会很好地工作。继续学习,伙计!:)但是如何更改操作栏的大小以及哪个主题最适合自定义栏?当然可以更改大小:但现在我建议您使用工具栏而不是操作栏,它比操作栏好,@sajolhossain您使用的主题是什么?theme.AppCompat.DayNight.noActionBar只需将其更改为其他主题,它就会很好地工作。继续学习,伙计!:)但如何更改操作栏的大小以及哪个主题最适合自定义栏?当然可以更改大小:但现在我建议您使用工具栏而不是操作栏,它比操作栏好,