All Projects → leifu1107 → ShapeView

leifu1107 / ShapeView

Licence: other
打造万能shape,再也不用写很多xml了,可以当做TextView,Button,EditText等多种控件,方便实用

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to ShapeView

Hyena
鬣狗快速开发库(2018年6月停止维护)
Stars: ✭ 21 (-38.24%)
Mutual labels:  button, textview, edittext
Sharpview
安卓带有尖角气泡的控件(TextView,ImageView,EditText,Layout),支持渐变色,圆角等自定义属性
Stars: ✭ 137 (+302.94%)
Mutual labels:  button, textview, edittext
TextViewPlus
an android library for setting custom font in xml layout
Stars: ✭ 27 (-20.59%)
Mutual labels:  button, textview, edittext
SuperShapeView
A smart custom view support shapes for ImageView, TextView ,EditView ,instead of shape.xml.(自定义形状控件,支持TextView,EditText)
Stars: ✭ 60 (+76.47%)
Mutual labels:  textview, edittext, shapeview
CustomFontView
Custom View classes for TextView, EditText & Buttons - to set custom fonts
Stars: ✭ 26 (-23.53%)
Mutual labels:  textview, edittext
textmatcher
A simple text watcher that matches specific targets like mention or hashtag in a string by defining rules
Stars: ✭ 67 (+97.06%)
Mutual labels:  textview, edittext
Gsyricktext
类似微博的emoji表情、@人、话题等的EdiText,优化了编辑框中的光标点击和删除处理。TextView支持emoji表情、话题、链接、电话和@某人特殊显示的文本。
Stars: ✭ 651 (+1814.71%)
Mutual labels:  textview, edittext
Rwidgethelper
Android UI 快速开发,专治原生控件各种不服
Stars: ✭ 996 (+2829.41%)
Mutual labels:  shape, textview
Xrichtext
一个Android富文本类库,支持图文混排,支持编辑和预览,支持插入和删除图片。
Stars: ✭ 1,639 (+4720.59%)
Mutual labels:  textview, edittext
Rxmarkdown
📠Markdown for Android, supports TextView && EditText (Live Preview), supports code high light.
Stars: ✭ 714 (+2000%)
Mutual labels:  textview, edittext
Toggleedittextview
Easily switch between EditText and TextView seamlessly.
Stars: ✭ 146 (+329.41%)
Mutual labels:  textview, edittext
React Ripples
🏊 Material ripple effect. Ripples everything
Stars: ✭ 160 (+370.59%)
Mutual labels:  ripple, button
EasyMoney-Widgets
The widgets (EditText and TextView) for support of money requirements like currency, number formatting, comma formatting etc.
Stars: ✭ 91 (+167.65%)
Mutual labels:  textview, edittext
KodeEditor
A simple code editor with syntax highlighting and pinch to zoom
Stars: ✭ 60 (+76.47%)
Mutual labels:  textview, edittext
Spedittool
An efficient and scalable library for inputing and displaying gif or @mention on graph-text mixed TextView/EditText
Stars: ✭ 292 (+758.82%)
Mutual labels:  textview, edittext
Android Commonshapebutton
To remove all shape files from the project, provide a generic shape style button.
Stars: ✭ 404 (+1088.24%)
Mutual labels:  shape, button
EasyTextView
🌈 🍀支持Java和Xml设置Shape、IconFont、IconFont+String、Span等具有丰富Api的TextView
Stars: ✭ 71 (+108.82%)
Mutual labels:  shape, textview
Flutter Neumorphic
A complete, ready to use, Neumorphic ui kit for Flutter, 🕶️ dark mode compatible
Stars: ✭ 988 (+2805.88%)
Mutual labels:  shape, button
Ng2 Konva
Angular & Canvas - JavaScript library for drawing complex canvas graphics using Angular.
Stars: ✭ 78 (+129.41%)
Mutual labels:  shape
Devshapeutils
一行代码设置Shape样式、Selector触摸反馈效果开源库
Stars: ✭ 161 (+373.53%)
Mutual labels:  shape

ShapeView

打造万能shape,再也不用写很多xml了,可以当做TextView,Button,EditText等多种控件,方便实用

效果图


属性说明(以下属性全部可以通过xml文件配置和代码进行设置)

属性名 描述 默认值 类型
sGravity 文字对齐方式
center(居中)
left(左对齐)
right(右对齐)
top(上对齐)
bottom(下对齐)
center(居中) enum
sShapeType shape四种类型
rectangle(矩形)
oval(椭圆形)
line(线型)
ring(环形)
rectangle(矩形) enum
sSolidColor 填充色 0x20000000 color
sPressedColor 按下时候颜色 0x20000000 color
sDisableColor 不可用时候颜色 0x20000000 color
sNormalColor 正常颜色 0x20000000 color
sCorners 圆角半径 0dp dimension
sCornersTopLeft 左上圆角半径 0dp dimension
sCornersTopRight 右上圆角半径 0dp dimension
sCornersBottomLeft 左下圆角半径 0dp dimension
sCornersBottomRight 右下圆角半径 0dp dimension
sStrokeWidth 边框宽度 1dp dimension
sStrokeDashWidth 虚线宽度 0dp dimension
sStrokeDashGap 虚线间隙宽度 0dp dimension
sStrokeColor 边框颜色 0x20000000 color
sSizeWidth shape的宽度 0dp dimension
sSizeHeight shape的高度 0dp dimension
sGradientType 渐变的种类
linear(线型)
radial(射线)
sweep(打扫)
linear(线型) enum
sGradientOrientation 渐变方向
TOP_BOTTOM(上下)
TR_BL(右上左下)
RIGHT_LEFT(右左)
BR_TL(下右上左)
BOTTOM_TOP(下上)
BL_TR(下左上右)
LEFT_RIGHT(左右)
TL_BR(上左下右)
enum
sGradientAngle 渐变角度 0dp dimension
sGradientCenterX 渐变x中心 0dp dimension
sGradientCenterY 渐变y中心 0dp dimension
sGradientGradientRadius 渐变半径 0dp dimension
sGradientStartColor 渐变开始颜色 -1 color
sGradientCenterColor 渐变中心颜色 -1 color
sGradientEndColor 渐变结束颜色 -1 color
sGradientUseLevel 使用LevelListDrawable时就要设置为true。设为false时才有渐变效果 false boolean
sUseSelector 是否使用selector false boolean
isEditText 是否做为edittext控件 false boolean

使用步骤

Step 1.添加依赖

项目的 build.gradle 添加

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

/app/build.gradle

	dependencies {
          compile 'com.github.leifu1107:ShapeView:1.0.1'
  }

Step 2项目中如何使用

2.1、布局中如何使用(示例中只列出部分属性,开发者可根据具体需求使用其他属性)

            <leifu.shapelibrary.ShapeView
                android:layout_width="100dp"
                android:layout_height="50dp"
                android:layout_marginLeft="10dp"
                android:text="两个圆角"
                android:textSize="10sp"
                app:sCornersBottomLeft="20dp"
                app:sCornersBottomRight="20dp"
                app:sSolidColor="@color/colorAccent"/>
        注意:
                1、设置 isEditText="true"可以变成eidttext,可以输入内容
                2、采用了一个第三方com.balysv:material-ripple:1.0.2 实现水波效果
		3.如果text显示不全,可能因为你设置字体过大或者设置padding=0(去除系统默认padding)

2.2、代码中如何使用

       /**
     * 可以通过链式设置大部分常用的属性值
     */

                
   shapeView.setShapeCorners(20)
                .setShapeCornersTopLeft(20)
                .setShapeCornersBottomLeft(20)
                .setShapeCornersTopRight(20)
                .setShapeCornersBottomRight(20)
                .setShapeStrokeColor(getResources().getColor(R.color.colorPrimary))
                .setShapeStrokeWidth(1)
                .setShapeSrokeDashWidth(1)
                .setShapeStrokeDashGap(5)
                .setShapeSolidColor(getResources().getColor(R.color.white))
                .setShapeSelectorNormalColor(getResources().getColor(R.color.red_btn))
                .setShapeSelectorPressedColor(getResources().getColor(R.color.gray))
                .useShape();//设置完各个参数之后这句调用才生效

APK文件

扫描二维码 或者 点击二维码 下载

ShapeView

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].