本文介绍了(安卓)如何风格的图案行动起来吧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要我的风格以类似的方式Android的动作条(示例 )。我知道,这是iOS的版本,它不适合于Android的指引,但是这是我的任务。我也知道我不能改变的状态栏的颜色,我的目标只是风格的动作吧。我想AP preciate任何提示如何做到这一点。

I need to style my Android actionbar in similar way (EXAMPLE).I know that this is iOS version and it isn't suits to Android guidelines, but this is my task.I also know I cant change color of status bar, my goal is only to style action bar.I would appreciate for any tips how to do it.

推荐答案

如果你想改变的动作条,创建您的preference一个自定义的。

If you want to change the ActionBar, create a custom one of your preference.

首先创建您的自定义动作条应该怎么看起来像一个XML布局。在这里,一定要添加ID到容器布局(线性布局)。在将需要在后面的步骤。

First create an XML layout on how your custom ActionBar should look like. Here make sure you add an ID to the container layout (Linear Layout). The will be required at the later steps.

在充气你的java code onCreate方法创建的XML布局如下,

Second Inflate the XML layout created in you java code onCreate method as follows,

LinearLayout myTitleBar = (LinearLayout) findViewById(R.id.the_id_you_set_in_first_step);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getSupportActionBar().setCustomView(R.layout.name_of_custom_xml_layout); //note that here its the layout name you set

注意:当你正在处理的动作条,你的应用程序的主题应设置为 Theme.AppCompat.Light

Note: As you are dealing with ActionBar, your application theme should be set to Theme.AppCompat.Light

要更多地了解他们,看看这个快速的视频教程演示的一样。

To learn more about them, have a look at this quick video tutorials demonstrating the same.

<一个href="http://www.youtube.com/watch?v=UVSSGaWGkzA&list=PLlxmoA0rQ-LyCGSSD_nuPAmXDSR_FU0RR&index=62"相对=nofollow>第一部分 - 5分钟

<一个href="http://www.youtube.com/watch?v=eW85amUN2cQ&list=PLlxmoA0rQ-LyCGSSD_nuPAmXDSR_FU0RR&index=63"相对=nofollow>第二部分 - 9分钟

<一个href="http://www.youtube.com/watch?v=js3_b0e0WWE&list=PLlxmoA0rQ-LyCGSSD_nuPAmXDSR_FU0RR&index=64"相对=nofollow>第三部分

希望它能帮助!

这篇关于(安卓)如何风格的图案行动起来吧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 22:37