使用9-Patch图片实现不失真按钮背景
来源:互联网 发布:昆明市工信委大数据局 编辑:程序博客网 时间:2024/06/06 04:09
1、使用Draw 9-patch工具制作图片
2、布局文件
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5px" android:orientation="vertical" > <Button android:id="@+id/button1" android:background="@drawable/green1" android:layout_margin="5px" android:layout_width="match_parent" android:layout_height="50px" android:text="我是普通图片背景" /> <Button android:id="@+id/button2" android:background="@drawable/green" android:layout_margin="5px" android:layout_width="450px" android:layout_height="150px" android:text="我是9-Patch图片背景(按钮宽度和高度固定)" /> <Button android:id="@+id/button3" android:background="@drawable/button_state" android:layout_margin="5px" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="我是9-Patch图片背景(单击会变色)" /> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android" ><item android:drawable="@drawable/red" android:state_pressed="true"/> <item android:drawable="@drawable/green" android:state_pressed="false"/></selector>
0 0
- 使用9-Patch图片实现不失真按钮背景
- 我的Android进阶之旅------>Android使用9Patch图片作为不失真背景
- 我的Android进阶之旅------>Android使用9Patch图片作为不失真背景
- 使用9Patch图片作为按钮背景
- Android------使用9Patch图片作为按钮背景
- 使用9Patch图片作为背景
- Android 使用9Patch图片做背景
- Android Nine Patch图片及按钮背景
- Android Nine Patch图片及按钮背景
- Android Nine Patch图片及按钮背景
- Android Nine Patch图片及按钮背景
- Android Nine Patch图片及按钮背景
- ****Android Nine Patch图片及按钮背景
- Android Nine Patch图片及按钮背景
- Android Nine Patch图片及按钮背景
- 使用9Patch图片作为背景防止图片拉伸
- android 9patch图片制作详解,解决图片拉伸失真
- Android实现图片压缩并且不失真
- 【Git】与【Github】的初级使用方法
- php 学习之字符串连接,数据比较, 自定义函数
- 坚定自我 守住寂寞
- IOCP模型编程注意点
- bzoj2600 ricehub 二分
- 使用9-Patch图片实现不失真按钮背景
- 【html】What is href=“#” and why is it used?
- HDOJ 1406 完数
- Mac OS install mongodb
- 新手自定义控件,创建属于自己的下拉刷新(一)---Android,ListView实现IOS的弹性效果
- 大前研一系列思维导图
- opencv小练习:哈尔小波(Haar)
- 如何使用STM32提供的DSP库进行FFT
- 【Android】Android 基础知识