Android:边框颜色GridView。没有背景

时间:2014-02-04 10:39:37

标签: android gridview colors background border

我使用GridView创建了一个应用程序,并设法使用background()更改所有图像的颜色。但我想要的是为每个图像添加一个红色边框,并在它们之间留一个空格。单击图像时也将颜色更改为绿色。我能做什么?感谢

1 个答案:

答案 0 :(得分:0)

在你的res / drawable中添加一个文件,例如。 border.xml并在其中放置类似的内容:

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
  <solid android:color="#FFFFFF" />
  <stroke android:width="1dip" android:color="#000000"/>
</shape>

在布局文件中使用:android:background =“@ drawable / border”。

相关问题