1. 如何更改一个安卓软件界面的颜色
通常来说,每个界面都对应一个activity。而在activity的View视图中,可以在最外层容器去设置背景图片或背景颜色。
在xml布局里:
android:background="@drawable/img1"
或者
android:background="@color/white"
在java代码里,也可以设置
1
2
3
layout.setBackgroundColor(R.color.white);
layout.setBackgroundDrawable(drawable);
layout.setBackgroundResource(R.drawable.img1);
再者,系统默认的背景色是能过theme来控制的,就是说创建一个activity的背景色,如果在
AndroidManifest.xml文件里有设置如下:
android:theme="@android:style/Theme"
这样设置activity的主题样式,"@android:style/Theme"一般是系统默认的。这个不单是背景色,还有其它的样式,具体可以在网上查一下android:theme的用法。
而"@android:style/Theme"的背景色就是黑色。
2. android中的menu的背景颜色如何设置请指教
.Factory,但是细节不是太清楚,请指点。 在strings.xml里配下info的颜色,如果是代码生成的可以用这个menu.add(0, 1, 0, "确定").setIcon(R.drawable.info);不知道这样是否符合你的要求drawable是图片的目录,strings是一些文本的属性,你说的能具体点吗? 问题补充:sunquanfeng 写道引用sunquanfeng 写道 在strings.xml里配下info的颜色,如果是代码生成的可以用这个menu.add(0, 1, 0, "确定").setIcon(R.drawable.info);不知道这样是否符合你的要求 android工程里不是有个strings.xml文件么,里面是配置资源的,你配一个 <drawable name="info">#0000ff</drawable>,我说的不是目录,你配好了就可以引用啊您说的方法不能解决问题。
3. 如何获取android界面某一个坐标点的颜色值
您好,很高兴为您解答: //根据坐标嫌租获取 ImageView imageView = ((ImageView)v); Bitmap bitmap = ((BitmapDrawable)imageView.getDrawable()).getBitmap(); int pixel = bitmap.getPixel(x,y); //获取颜芹晌兆色 int redValue = Color.red(pixel); int blueValue = Color.blue(pixel); int greenValue = Color.green(pixel); 转载,仅供参考,如果我的谨袜回答没帮助到您,请继续追问。
4. android 里用shape画圆,怎么填充颜色
Android里面使用shape设置控件的外形,例如一些圆角、填充的背景颜色、以及一些渐变的效果等,所以设置填充颜色,可通过设置shape.xml文件里的如下属性:
<solidandroid:color="@color/common_red"/>
将shape文件放到android的button、textview组件上,就可以有填充背景颜色的效果,完整的代码如下:
1.shape.xml
<?xmlversion="1.0"encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false">
<solidandroid:color="@color/common_red"/>
<padding
android:left="2dp"
android:top="1dp"
android:right="2dp"
android:bottom="1dp"/>
<solid
android:color="@color/common_red"/>
<stroke
android:width="1dp"
android:color="@android:color/white"/>
<sizeandroid:width="15dp"
android:height="15dp"/>
</shape>
2.把以上代码添加到drawable里面、通过background引用就可以了
<TextView
android:id="@id/message_category_unread_count"
style="@style/comm_text_style_14_aaaaaa"
android:layout_marginLeft="70dp"
android:layout_marginTop="5dp"
android:background="@drawable/shape"
android:gravity="center"
android:textSize="@dimen/text_size_comment_20"
android:text="7"
android:textColor="@android:color/white"/>
效果如下图: