Android之9-Patch图

Android之9-Patch图,第1张

新建9-Patch

res->xxx.png 中右键打开选项,点击create 9-Patch file,即可生成尾缀为xxx.9.png的文件

9-Patch编辑栏的参数含义

Zoom 左侧编辑栏大小Patch scale 右侧预览栏大小Show content 内容放置区域(图中紫色区域),如给TextView设置.9.png的background,在紫色区域放置TextShow patches 编辑大小 制作9-Patch

调整左上两条线的大小设置拉伸区域调整右小两条线的大小设置内容区域点击左键新增区域,点击Shift+左键删除 使用9-Patch

在xml文件中使用

 <TextView
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_below="@+id/btn_tiny"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:background="@mipmap/bubble" 
        android:text="@string/str_long"
        android:textSize="30sp" />

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/956986.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-18
下一篇 2022-05-18

发表评论

登录后才能评论

评论列表(0条)

保存