android代码怎么打成蓝色,如何将我的Android应用程序的重音颜色从蓝色更改为其他颜色...

自从你提出这个问题以来已经有一段时间了,但是现在google已经发布了一个新的AppCompat版本,你可以很简单地完成你想要实现的目标.我给你的答案灵感来自

android developer blog support library 2.2.1.

>将支持库添加到项目中(假设您使用的是Android Studio).

为此,将这些行添加到app.graddle文件中(假设您的模块名为app).

dependencies {

compile 'com.android.support:appcompat-v7:22.2.0'

}

>设置应用程序的主题

这些行将添加到styles.xml文件中.正如您所看到的,这种风格中有一些项目.如果你想知道它们对应的元素,请查看customize android status bar with material.

colorAccent是您想要首先改变的颜色.

@color/primary

@color/primaryDark

@color/accent

@color/textColorPrimary

@color/windowBackground

@color/navigationBarColor

您还需要在Android清单中设置应用程序主题

android:theme="@style/AppTheme" >

...

>在类中将Activity / ActionBarActivity更改为AppCompatActivity.

public class MainActivity extends AppCompatActivity

{

....

}

由于AppCompatActivity,您可能需要更改一些方法.看看第一个链接中的视频,以便更好地理解:)

>将您的小部件更改为AppCompat小部件

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent">

android:id="@+id/text"

android:text="@string/hello_world"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />

android:id="@+id/btn_start"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/btn_start" />

Etvoilà!这就是你所有的设置:)你现在可以轻松地改变强调颜色.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值