美文网首页
shape:编辑两端为半圆的矩形图案

shape:编辑两端为半圆的矩形图案

作者: StoneHui | 来源:发表于2017-08-25 10:23 被阅读483次

一个 drawable 文件完成不同尺寸的端半圆矩形图案绘制。

预期效果

image.png

编辑 drawable 资源

shape_auto_end_semicircle.xml

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android">

    <solid android:color="@android:color/holo_blue_bright"/>

    <size android:height="9999dp"/>

    <corners android:radius="9999dp"/>

</shape>

使用 drawable 资源

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:id="@+id/layout_root"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical">

    <View
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:background="@drawable/shape_auto_end_semicircle"/>

    <View
        android:layout_width="20dp"
        android:layout_height="40dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/shape_auto_end_semicircle"/>

    <View
        android:layout_width="60dp"
        android:layout_height="20dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/shape_auto_end_semicircle"/>

    <View
        android:layout_width="100dp"
        android:layout_height="25dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/shape_auto_end_semicircle"/>

    <View
        android:layout_width="140dp"
        android:layout_height="30dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/shape_auto_end_semicircle"/>

</LinearLayout>

相关文章

  • shape:编辑两端为半圆的矩形图案

    一个 drawable 文件完成不同尺寸的端半圆矩形图案绘制。 预期效果 编辑 drawable 资源 shape...

  • shape 和selector的使用

    shape 属性 shape的形状,默认为矩形,可以设置为矩形(rectangle)、椭圆形(oval)、线性形状...

  • css实现漂亮的卡片样式,半圆效果

    css实现漂亮的卡片样式,卡券两端半圆缺口效果 最近项目中遇见了需要在矩形两端挖半圆的卡券设计,一般我们在设计飞机...

  • 形状图形(shape)

    shape 常用属性 android:shape="rectangle" 矩形,默认值android:shape...

  • 半圆角矩形

    有时候我们做项目的时候,会遇到个不同的视图,比如半圆角矩形 这样的视图我们改如何做呢?最为简单的方法就是先做一个圆...

  • android常用shape(直接copy)

    新建shape文件,颜色需要自己定义 shape属性:(默认矩形) line--线oval--椭圆rectangl...

  • 安卓样式之shape(形状)

    背景形状定义工具 shape可以自定义形状 属性 android:shape 值 rectangle矩形 oval...

  • shape

    android:shape="rectangle"|"oval"|"line"|"ring"//共有4种类型,矩形...

  • 杂记

    一、ViewPager实现新手引导 二、圆角矩形设置 圆角矩形背景、颜色、弧度可以使用shape定义的drawab...

  • android用shape画虚线,怎么也不显示

    原文地址:android用shape画虚线,怎么也不显示 一直以为android的shape能画直线,虚线,矩形,...

网友评论

      本文标题:shape:编辑两端为半圆的矩形图案

      本文链接:https://www.haomeiwen.com/subject/ldfudxtx.html