Android的ImageView的带有圆角不工作 [英] Android ImageView with Rounded Corners not working

查看:186
本文介绍了Android的ImageView的带有圆角不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经definied文件thumb_rounded.xml,并把它放在RES /绘制文件夹中的我的Andr​​oid应用程序。有了这个文件,我想圆角我ImageViewthat包含新闻大拇指,

I have definied the file thumb_rounded.xml and placed it inside the res/drawable folder in my android application. With this file i want to get rounded corners in my ImageViewthat contains the news thumb,

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners android:radius="13.0dip" />
</shape>

和我设置这是我的ImageView的背景,但我不明白的圆角,图像仍然是一个矩形。有没有人对如何获得任何想法?我想达到同样的效果,因为这画面:

and i am setting this as background of my ImageView, however, i dont get the rounded corners, the image remains a rectangle. Does anyone have any idea on how to get that? I want to achieve the same effect as this screen:

感谢

T

推荐答案

你缺乏了几个标签。这里有一个新的样本:

You're lacking a couple of tags. Here's a new sample:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
    <solid android:color="#ffffff"/>    

    <stroke android:width="3dp"
            android:color="#ff000000"/>

    <padding android:left="1dp"
             android:top="1dp"
             android:right="1dp"
             android:bottom="1dp"/> 

    <corners android:radius="30px"/> 
</shape>

看<一href="http://stackoverflow.com/questions/2310209/android-cant-create-simple-rectangle-shape-unsupportedoperationexception">here

另外,你是否知道 RoundRectShape 的?

Also, are you aware of RoundRectShape?

这篇关于Android的ImageView的带有圆角不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆