【问题标题】:How to change the customize Window title bar and its icon for multiple activities如何为多个活动更改自定义窗口标题栏及其图标
【发布时间】:2014-10-07 10:45:41
【问题描述】:
【问题讨论】:
标签:
android
user-interface
android-activity
【解决方案1】:
只需在自定义布局中设置 imageview 和 textview id 并在特定 Activity 中动态设置其值
ImageView image=(Imageview)getWindow().findViewById(your image view id);
TextView title=(Textview)getWindow().findViewById(your image view id);
设置image.setImageResource(...);
和title.settext(title);
就是这样……
【解决方案2】:
不要让应用程序标签上的主题改为您的活动。例如:
<activity
android:theme="@style/themeForAcitivy"
android:name="MyActivity">
</activity>
您也可以在每个活动上调用 getActionBar().setCustomView(R.layout.myCustomBar) 来创建自定义的 ActionBar 视图,如果这也适合您的话。