(安卓)如何风格的图案行动起来吧来吧、图案、风格、行动

由网友(狂躁型MAN)分享简介:我要我的风格以类似的方式Android的动作条(的的示例的 )。我知道,这是iOS的版本,它不适合于Android的指引,但是这是我的任务。我也知道我不能改变的状态栏的颜色,我的目标只是风格的动作吧。我想AP preciate任何提示如何做到这一点。 I need to style my Android act...

我要我的风格以类似的方式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.

第一部分 - 5分钟

第二部分 - 9分钟

第三部分

希望它能帮助!

阅读全文

相关推荐

最新文章