【发布时间】:2015-02-03 10:56:17
【问题描述】:
我尝试创建带有圆角的图像视图。我搜索并找到了 xml 代码
<?xml version="1.0" encoding="utf-8"?>
<solid android:color="#00ffffff" />
<padding
android:bottom="6dp"
android:left="6dp"
android:right="6dp"
android:top="6dp" />
<corners android:radius="12dp" />
<stroke
android:width="6dp"
android:color="#ffffffff" />
这是我的 imageview xml 代码
<ImageView
android:id="@+id/slidemenuuserimage"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="16dp"
android:layout_marginLeft="14dp"
android:background="@drawable/frame" />
我有一个问题。当我以编程方式添加背景图像时,我收到了不同的结果。
slidemenuuserimage=(ImageView)findViewById(R.id.slidemenuuserimage);
slidemenuuserimage.setBackgroundResource(R.drawable.myuserimg);
这是我的结果
如何以编程方式向左或向右添加填充。在我的选项中,这是我的问题 如果有人知道解决方案,请帮助我
【问题讨论】:
-
现在有什么问题?
标签: android android-imageview rounded-corners