我有列表视图,并且我有一组图像连续。我想为图像添加边框是最简单的方法。在列表视图中放置图像边框的方法
2
A
回答
2
把这个在绘制文件夹名称image_border.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="2dip" android:color="#8d8d8d" />
<padding
android:left="1dip"
android:top="1dip"
android:right="1dip"
android:bottom="1dip" />
<solid android:color="#000000" />
<corners android:radius="10dip" />
</shape>
和使用属性android:background="@drawable/image_border"
为ImageView的
您可以根据您的要求改变形状。
0
我得到了你的问题 现在,如果你在你的XML文件中有ImageView的,那么你也有这样的代码如下:
<ImageView
android:id="@+id/imgIcon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
/>
因此,在您的ImageView标签下面添加一行:
android:background="@drawable/Imagexml"
android:padding="6dp"
现在如在android:background中有可绘制文件夹中的Imagexml.xml文件。
的Imagexml.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<gradient
android:startColor="#0079AD"
android:endColor="#009AD6"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#F1FAFE" />
<corners
android:radius="10dp" />
</shape>
</item>
<item android:state_focused="true" >
<shape>
<gradient
android:endColor="#007900"
android:startColor="#009A77"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#F1FAFE" />
<corners
android:radius="3dp" />
</shape>
</item>
<item>
<shape>
<gradient
android:endColor="#0079AD"
android:startColor="#009AD6"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#F1FAFE" />
<corners
android:radius="3dp" />
</shape>
</item>
</selector>
然后只要你想,你会得到的结果。
相关问题
- 1. 在C#2008中为列表视图图像设置边框
- 2. 在列表视图中为图像绘制边框
- 3. 在边框上放置图像
- 4. 将文本视图放在列表视图中的方法
- 5. 在Android中的Getview方法放置列表视图
- 6. 无法在CSS边框中居中放置图像
- 7. 在多边形图像贴图上放置边框?
- 8. 缩放放置在图像视图中的图像的控件?
- 9. 在WPF列表框中缩放图像
- 10. IOS:在图像视图中设置图像的快速方法
- 11. 在列中放置图像
- 12. 在视图中放置图像
- 13. 的Android留在选中的列表项边框列表视图
- 14. 在图像视图中淡入图像边框
- 15. 在android中的另一个图像视图中放置图像
- 16. 列表视图的弧形边框
- 17. 将矩阵图像放置在图像视图的中心
- 18. Android-如何在列表视图中显示图像圆边缘
- 19. 把背景图像放在右边10px边框带边框
- 20. 如何在列表视图中设置数组列表图像视图
- 21. 无法在下方放置视图RecyclerView
- 22. 在列表视图中认为“外”框中的Android图像
- 23. 在列表视图中有边框的表格
- 24. 如何在侧边栏框中放置图像
- 25. 在列表视图下放置片段
- 26. 在自定义视图列表视图项中缩放位图图像
- 27. 在视图的一侧设置边框?
- 28. ReactNative:在Circle-View的边框上放置一个视图
- 29. 图像的列表视图
- 30. 图像的列表视图
接受答案,如果你有解决方案 – 2012-07-09 06:42:41