如何改变只有一个项目的背景样式/颜色图库视图/ GridView的? [英] how to change background style/color of just one item in GalleryView/GridView?
问题描述
我有一个小部件图库视图在我的Android应用程序,我想改变中央项目的背景样式/颜色的小部件,使其从休息中脱颖而出。更妙的是,如果我可以让这家位于项目大尺寸比其他人。
I have a GalleryView widget in my android app and I would like to change the background style/color of the central item in the widget, so that it stands out from the rest. Even better, if I could make this central item bigger size than the rest.
任何想法?
推荐答案
您可以在特定的布局设置backgorund颜色(UR选择)
比如你有5个编辑框上面的2 2的下方,1个在中心
谁ü想改变背景颜色U可以做以下
You can set the backgorund colour (ur choice) in the specific layout for example you have 5 edit box 2 above 2 below and 1 in center whom u wanna change the background color u can do the following
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:background="#000000"
android:orientation="vertical"
android:padding="5px" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/id1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/id2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#435232"
android:orientation="horizontal" >
<EditText
android:id="@+id/id3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:digits="0123456789"
android:maxLength="6" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/id4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/id5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:digits="0123456789"
android:maxLength="11" />
</LinearLayout>
</LinearLayout>
正如你可以看到我改变甲肝第三届编辑文本的背景颜色以同样的方式ü也可以做到这一点。
As you can see i hav changed the background colour of 3rd edit text in the same way u can also do that
这篇关于如何改变只有一个项目的背景样式/颜色图库视图/ GridView的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!