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"/>
效果如下圖: