Android(安卓)9Patch图片
16lz
2021-12-04
在Android SDK安装路径下的tools目录下找到draw9path.bat,双击运行。制作9Path图片。
layout.xml
<?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:orientation="vertical">
<Button android:text="普通图片作为Button背景" android:textSize="20dip"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/myselectora" />
<Button android:text="9Patch图片作为Button背景" android:textSize="20dip"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/myselectorb" />
</LinearLayout>
第二个按钮的背景为9patch图片,被拉伸后如下:
更多相关文章
- Android剪切图片
- android xml中设置自适应图片
- Android(安卓)Gallery的使用
- Android(安卓)之 ImageView(图片组件)
- Android使用Shape实现布局圆角边框
- android selector的使用
- android多点触摸缩放图片
- android imageVIew拖动 && 图片缩放
- 图片走廊