更改默认设计主题定制颜色? [英] Change default design theme to customized color?

查看:380
本文介绍了更改默认设计主题定制颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很新到Android工作室。作为一个初学者我创建了一个简单的应用程序只是用于测试目的,并查看Android的工作室材料主题的外观。我目前正在与最新版本的IE工作。大号preVIEW - 工作室0.8.2版本

I am very new to Android studio. As a beginner I have created a simple app just for testing purpose and to view the appearance of Android studio material theme. I am currently working with latest version ie. L preview - Studio 0.8.2 version.

在这里,我刚刚创建的TextView,EditText上,单选按钮和复选框。当我选择男性或女性,似乎天空的蓝色。我可能是能够改变天蓝色作为绿色或黄色的颜色吗?

Here, I have just created textview, edittext, radio buttons and checkboxes. When I select male or female, it appears sky blue color. Could I be able to change sky blue color as a green or yellow color?

我不知道什么是这个名字。从图片可以看到选中状态为天蓝色的EditText,单选按钮和复选框。当我尝试点击或选择任何内容,然后这些复选框或单选按钮需要从默认颜色更改为其他颜色,如绿色或黄色!

I do not know what is the name for that. From the picture can able to see edittext, radio buttons and checkboxes selected state as a sky blue color. When I try to click or select anything then those checkboxes or radio buttons need to change from default color to other colors like green or yellow!

在RES /价值/ styles.xml,

In res/values/styles.xml,

<resources>
<!-- Base application theme. -->
<color name="custom_theme_color">#b0b0ff</color>
<style name="CustomTheme" parent="android:Theme.Material">
<item name="android:colorBackground">@color/custom_theme_color</item>
</style>
</resources>

在Android Studio中的Manifest.xml,

In Android Studio Manifest.xml,

android:theme="@style/CustomTheme" >

请任何人都可以说,我 - 有没有其他可能从默认的天蓝色变成绿色或黄色或紫色??

Please can anyone say me - Is there any other possible to change from default sky blue color to green or yellow or purple??

有没有其他的方法来改变默认的天蓝色主题,其他颜色的粉红色或绿色的?

Is there any other way to change default sky blue color theme to other colors like pink or green?

我想了解,请给我一些建议 - 我应该怎么办呢?如果我问这里有什么问题,请见谅!

I would like to learn so please give me some suggestion - How should I do this? If I have asked anything wrong here please forgive me!

推荐答案

在RES /值-V21 / styles.xml,

First Method:

In res/values-v21/styles.xml,

<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
    <item name="android:colorAccent">@color/custom_theme_color</item>
    <item name="android:colorPrimaryDark">@color/custom_theme_color</item>
    <item name="android:colorPrimary">@color/custom_theme_color</item>
</style>

以上code是简单而运作良好。在Android Studio中,它可能是能够从默认天蓝颜色更改为任何其他颜色的粉红色或绿色的!

The above code is simple and working well. In Android studio, it could be able to change from default sky blue color to any other colors like pink or green!

创建下的XML即3个文件。 RES / XML如checked.xml,unchecked.xml和custom_checkbox.xml

Create 3 files under xml ie. res/xml such as checked.xml, unchecked.xml and custom_checkbox.xml

checked.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="2px" android:color="#FF00FF" />
<size android:height="20dp" android:width="20dp"/>
</shape>

unchecked.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="2px" android:color="#ffc0c0c0" />
<size android:height="20dp" android:width="20dp"/>
</shape>

custom_checkbox.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" 
      android:drawable="@xml/checked" /> 
<item android:state_pressed="true"
      android:drawable="@xml/checked" /> 
<item android:drawable="@xml/unchecked" /> 
</selector>

从上面第二种方法,它(自定义文件),也可能是能够创建基于我们要求的任何形状和颜色。甚至我们可以能够通过使用第二个方法用于自定义插件的风格,形状和主题。

From above second method, it (customized file) also could be able to create any shapes and colors based on our requirements. Even we can be able to customize the style, shapes and themes for a widget by using 2nd method.

以上两种方法都在为我好!

Above two methods are working fine for me!

这篇关于更改默认设计主题定制颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆