繁体   English   中英

ImageView喜欢另一个ImageView Android的边框

[英]ImageView like border for another ImageView Android

我想在另一个imageView中动态插入一个imageView。 一个imageView总是固定的,我想像边框一样使用它。 第二个imageView动态插入另一个和CENTER_INSIDE中。

有可能的?

不要使用ImageView比另一个ImageView 在您的情况下,请按照这些步骤

1-创建一个xml文件imageview_border.xml并将其放在具有以下内容的drawable文件夹中:

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

2-现在分配android:background="@drawable/imageview_boder"

3-使用android:src属性将图像分配给ImageView ,如下所示:

android:src="@drawable/yourimage"

也许你可以使用9补丁图片: http//developer.android.com/tools/help/draw9patch.html

Draw 9-patch工具是一个WYSIWYG编辑器,允许您创建位图图像,自动调整大小以适应视图内容和屏幕大小。 图像的选定部分基于水平或垂直基于图像内绘制的指示符进行缩放。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM