给android图像设置圆角样式(Android Shapes – Example)(quoted)
来源:互联网 发布:淘宝权重查询 编辑:程序博客网 时间:2024/06/10 11:09
Android Shapes – Example
In Android you can use Shape Drawables to define background, borders and gradients for your Views. You find the possible types here.
To define a shape create a XML file in your drawable folder. For example:
1
2
3
4
5
6
7
8
9
10
11
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="2dp" android:color="#FFFFFFFF" />
<gradient android:startColor="#DD000000" android:endColor="#DD2ECCFA"
android:angle="225"/>
<corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
</shape>
Assign it for example to a LinearLayout.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@drawable/myshape">
<EditText android:layout_width="fill_parent" android:text="1"
android:layout_height="wrap_content" android:id="@+id/editText1"
android:inputType="numberSigned"
android:layout_margin="5dip" android:gravity="center">
<requestFocus></requestFocus>
</EditText>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/button1"
android:text="@string/start"></Button>
</LinearLayout>
And you get:
instead of
I hope this helps.
- 给android图像设置圆角样式(Android Shapes – Example)(quoted)
- android.graphics(一)shapes
- android样式学习(二) android给listview设置分割线Divider样式
- android.graphics.drawable.shapes
- android给listview设置分割线Divider样式
- Android给ListView设置分割线Divider样式
- android给listview设置分割线Divider样式
- Android给ListView设置分割线Divider样式
- Android给ListView设置分割线Divider样式
- 给Android Studio设置代码字体大小与界面字体样式
- Android给图片设置圆角
- android设置Toast样式
- android 设置文字样式
- android设置字体样式
- android SeekBar 样式设置
- android设置字体样式
- android DatePicker样式设置
- Android样式设置总结
- 掌控大局
- .网站用户行为分析:揭秘用户为什么放弃你的网站
- 黑马程序员_学习日记54_626三层项目(三层案例)
- 黑马程序员-内部类
- 一些牛人榜样,多看看他们写的东西(后续整理牛人的blog等)
- 给android图像设置圆角样式(Android Shapes – Example)(quoted)
- mysql1
- 因特尔8051的两大亮点
- Android:限制EditText中只可以输入字母和数字
- 使用apache StringUtils.split替代String.split
- BASH编程中会遇到的24个陷阱
- input子系统学习笔记三 驱动的分层及设备驱动层实现原理
- PHP扩展中获取Get请求的数据_Get,Server
- input子系统学习笔记四 软件设计流程及相关API