Skip to content

To remove all shape files from the project, provide a generic shape style viewgroup.

License

Notifications You must be signed in to change notification settings

michaelxs/Android-CommonShapeViewGroup

Repository files navigation

CommonShapeViewGroup

[点击查看中文版]

To remove all shape files from the project, provide a generic shape style viewgroup.

API License

Attribute

<declare-styleable name="CommonShapeViewGroup">
    <attr name="csvg_shapeMode" format="enum">
        <enum name="rectangle" value="0" />
        <enum name="oval" value="1" />
        <enum name="line" value="2" />
        <enum name="ring" value="3" />
    </attr>
    <attr name="csvg_fillColor" format="color" />
    <attr name="csvg_strokeColor" format="color" />
    <attr name="csvg_strokeWidth" format="dimension" />
    <attr name="csvg_cornerRadius" format="dimension" />
    <attr name="csvg_cornerPosition">
        <flag name="topLeft" value="1" />
        <flag name="topRight" value="2" />
        <flag name="bottomRight" value="4" />
        <flag name="bottomLeft" value="8" />
    </attr>
    <attr name="csvg_startColor" format="color" />
    <attr name="csvg_endColor" format="color" />
    <attr name="csvg_orientation" format="enum">
        <enum name="TOP_BOTTOM" value="0" />
        <enum name="LEFT_RIGHT" value="1" />
    </attr>
    <attr name="csvg_withElevation" format="boolean" />
</declare-styleable>

Usage

RelativeLayout

<com.blue.view.ShapeRelativeLayout
    android:layout_width="200dp"
    android:layout_height="120dp"
    app:csvg_cornerRadius="8dp"
    app:csvg_fillColor="#00bc71"
    app:csvg_withElevation="true">
  // child view
</com.blue.view.ShapeRelativeLayout>

ConstraintLayout

<com.blue.view.ShapeConstraintLayout
    android:layout_width="200dp"
    android:layout_height="120dp"
    app:csvg_cornerPosition="topRight|bottomRight"                                 
    app:csvg_cornerRadius="20dp"
    app:csvg_startColor="#8800bc71"
    app:csvg_endColor="#00bc71"
    app:csvg_orientation="LEFT_RIGHT">
  // child view
</com.blue.view.ShapeConstraintLayout>

License

Apache-2.0

Update

2018-10-23 : add java implementation

About

To remove all shape files from the project, provide a generic shape style viewgroup.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages