我想做一个button圆角.有没有一种简单的方法可以在Android中实现这一目标?
所以,有人知道如何使用Glide显示带圆角的图像吗?我正在使用Glide加载图像,但我不知道如何将舍入的参数传递给此库.
我需要显示图像如下例子:

我需要在Android UI中绘制一个圆角矩形.具有相同的圆角矩形TextView,并EditText也将是有益的.
有没有办法在android(Honeycomb)中定义ViewGroup的剪辑区域?例如,我有一个带有圆角的图像背景的ListView.当我滚动列表时,孩子们伸出背景的角落 - 我宁愿他们在圆角内剪辑.

左图是它目前正在做的,右边是我想要的.
我在看ClipDrawable,但似乎这只能用于进度条?
此外,我正在尝试在小部件中执行此操作.所以我不能使用自定义视图并覆盖onDraw进行屏蔽.
谢谢!
我正在寻找过去的一天,但我没有成功.
我从API获取图像,然后使用以下代码将其下载到位图文件.
private Bitmap DownloadImage(String URL)
{
Bitmap bitmap = null;
InputStream in = null;
try
{
in = OpenHttpConnection(URL);
bitmap = BitmapFactory.decodeStream(in);
in.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
return bitmap;
}
private InputStream OpenHttpConnection(String urlString) throws IOException
{
InputStream in = null;
int response = -1;
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
if (!(conn instanceof HttpURLConnection))
throw new IOException("Not an HTTP connection");
try
{
HttpURLConnection httpConn = (HttpURLConnection) conn;
httpConn.setAllowUserInteraction(false);
httpConn.setInstanceFollowRedirects(true);
httpConn.setRequestMethod("GET");
httpConn.connect();
response …Run Code Online (Sandbox Code Playgroud) 我有什么 ::我有一个Imageview,我使用picassso将图像作为一个圆圈

我该怎么做 ::我想使用我当前的实现为圆形图像添加黑色边框,如何在不使用第三方库的情况下实现此目的
Picasso.with(this)
.load("http://i.imgur.com/DvpvklR.png")
.transform(new RoundedTransformation(50, 4))
.resize(100, 100)
.centerCrop().into(imageView1);
Run Code Online (Sandbox Code Playgroud)
RoundedTransformation.java
// enables hardware accelerated rounded corners
// original idea here : http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/
public class RoundedTransformation implements com.squareup.picasso.Transformation {
private final int radius;
private final int margin; // dp
// radius is corner radii in dp
// margin is the board in dp
public RoundedTransformation(final int radius, final int margin) {
this.radius = radius;
this.margin = margin;
}
@Override
public Bitmap transform(final Bitmap source) {
final Paint paint …Run Code Online (Sandbox Code Playgroud) 我有以下代码来分隔要绘制的视图的区域:
Rect rect = new Rect();
rect.set(0, 0, 100, 100);
View.setClipBounds(rect);
Run Code Online (Sandbox Code Playgroud)
这将仅在指定的矩形(或在本例中为正方形)上绘制我的视图.但是,我希望将视图剪切为圆形.有没有办法以某种方式绕过Rect对象的角落?
我正在尝试制作圆形的表面视图.我搜索了很多,但我找不到一个好的解决方案.我现在正在做的是,我将SurfaceView放入FrameLayout,然后将另一个View放在它上面,或者使用PNG蒙版,或者使用形状xml drawable.这里是
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="140dp"
android:layout_height="140dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#000"
android:orientation="vertical"
android:visibility="visible" >
<FrameLayout
android:id="@+id/videorecordview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_weight=".2" >
<SurfaceView
android:id="@+id/surfaceView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/rounded"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
但这不是一个好的解决方案,也不是完美的.我想将surfaceview自定义为圆形.任何帮助将非常感激.谢谢 :)