ImageView的只有两个边角圆润? [英] ImageView with only two corners rounded?

查看:155
本文介绍了ImageView的只有两个边角圆润?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想与右上角和放大器的ImageView的;左下角圆形。


 <角落
机器人:topRightRadius =10dp
机器人:bottomLeftRadius =10dp
机器人:topLeftRadius =0dp
机器人:bottomRightRadius =0dp/>


试过上述code,但它不是working.Please帮助!


解决方案

 <?XML版本=1.0编码=UTF-8&GT?;
<形状的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android>
[固体机器人:色=@机器人:彩色/ darker_gray/>
<角落的an​​droid:topRightRadius =10dp
    机器人:bottomRightRadius =0dp
    机器人:topLeftRadius =0dp
    机器人:bottomLeftRadius =10dp/>< /形状>

这是我在绘制文件夹中可绘制shape.xml。而我用这绘制设置imageviews背景。

 < ImageView的
    机器人:ID =@ + ID / imageView1
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:SRC =@绘制/ ic_launcher
    机器人:背景=@绘制/形状/>

完成,当你在设备/仿真器上运行的应用程序它会出现(惯于出现在XML图形布局)

I want to have an ImageView with top right corner & bottom left corner rounded.

<corners 
android:topRightRadius="10dp"
android:bottomLeftRadius="10dp"
android:topLeftRadius="0dp"
android:bottomRightRadius="0dp"/>

Tried the above code , but it's not working.Please help!

解决方案

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@android:color/darker_gray"/>
<corners android:topRightRadius="10dp"
    android:bottomRightRadius="0dp"
    android:topLeftRadius="0dp"
    android:bottomLeftRadius="10dp"/>

</shape>

This is my drawable shape.xml in drawable folder. And I am using this drawable to set imageviews background.

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_launcher"
    android:background="@drawable/shape"/>

Done It will appear when you run app on device/emulator (Wont appear in xml graphical layout)

这篇关于ImageView的只有两个边角圆润?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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