All Projects → DrownCoder → EasyTextView

DrownCoder / EasyTextView

Licence: Apache-2.0 license
🌈 🍀支持Java和Xml设置Shape、IconFont、IconFont+String、Span等具有丰富Api的TextView

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to EasyTextView

ShapeView
打造万能shape,再也不用写很多xml了,可以当做TextView,Button,EditText等多种控件,方便实用
Stars: ✭ 34 (-52.11%)
Mutual labels:  shape, textview
Rwidgethelper
Android UI 快速开发,专治原生控件各种不服
Stars: ✭ 996 (+1302.82%)
Mutual labels:  shape, textview
Sketch Make Long Shadow
A plugin for Sketch to create long shadows of a user defined length from a shape.
Stars: ✭ 92 (+29.58%)
Mutual labels:  shape
Unity3D-Hypersolids
◻️ A Way To Create, Show, and Rotate 4D Objects in Unity 3D
Stars: ✭ 24 (-66.2%)
Mutual labels:  shape
D3 3d
D3.js plugin for 3d visualization
Stars: ✭ 203 (+185.92%)
Mutual labels:  shape
Sketch React
render sketch(v43+) file as react component
Stars: ✭ 98 (+38.03%)
Mutual labels:  shape
Gooey React
The gooey effect for React, used for shape blobbing / metaballs (0.5 KB) 🧽
Stars: ✭ 219 (+208.45%)
Mutual labels:  shape
Phidl
Python GDS layout and CAD geometry creation
Stars: ✭ 56 (-21.13%)
Mutual labels:  shape
react-native-bottom-bar
Fully customizable BottomBar with unique design shape for React Native.
Stars: ✭ 74 (+4.23%)
Mutual labels:  shape
Devshapeutils
一行代码设置Shape样式、Selector触摸反馈效果开源库
Stars: ✭ 161 (+126.76%)
Mutual labels:  shape
Tracks
Programming with shapes
Stars: ✭ 151 (+112.68%)
Mutual labels:  shape
Shapeshifter
🐺 Generate relational schemas, PropTypes, Flow aliases, and TypeScript interfaces from JSON or GraphQL schematic files.
Stars: ✭ 105 (+47.89%)
Mutual labels:  shape
Motion Shapeofview
Explain how to use MotionLayout with ShapeOfView
Stars: ✭ 236 (+232.39%)
Mutual labels:  shape
Shapes
📐 Net standard geometry/shape manipulation library, can be used to merge / split shapes
Stars: ✭ 95 (+33.8%)
Mutual labels:  shape
RadiusView
[1.1.0以后版本由UIWidget维护,不做更新]Android 实现一个用于需要圆角矩形框背景的TextView或Layout的情况,减少直接使用时引入的shape资源文件,包括RadiusTextView,RadiusEditText,RadiusLinearLayout,RadiusRelativeLayout,RadiusFrameLayout,RadiusCheckBox,RadiusRadioButton,主要有圆角控制、默认背景(边框线)、按下背景(边框线)、不可点击背景(边框线)、选择selected背景(边框线)、选中checked背景(边框线);全圆角、四角单独设置圆角功能
Stars: ✭ 13 (-81.69%)
Mutual labels:  shape
Ng2 Konva
Angular & Canvas - JavaScript library for drawing complex canvas graphics using Angular.
Stars: ✭ 78 (+9.86%)
Mutual labels:  shape
Marlin Renderer
Marlin is the FAST Java2D antialiasing rasterizer derived from OpenJDK Pisces (shape)
Stars: ✭ 146 (+105.63%)
Mutual labels:  shape
Flutter Shapeofview
Give a custom shape to any flutter widget, Material Design 2 ready
Stars: ✭ 211 (+197.18%)
Mutual labels:  shape
CountDownTextView
A count down widget for verify code
Stars: ✭ 22 (-69.01%)
Mutual labels:  textview
TypedTextView
Custom implementation of Android's TextView simulating a keyboard/type-writer.
Stars: ✭ 57 (-19.72%)
Mutual labels:  textview

基于iconfont拓展的TextView(支持左右设置Text,设置Shape,设置span等)

continuousphp Hex.pm

项目介绍

  • 还在苦于iconfont左右两边还需要设置文字只能加两个TextView?
  • 还在苦于需要设置各种大同小异的边框而new Shape文件吗?
  • 还在苦于设置点击效果而多种样式吗?

一个基于iconfont拓展的支持多种功能的轻量级TextView,减少布局嵌套,减少定义shape文件,基本涵盖常规需要多个TextView实现的功能。(最多支持左中右三段文字)

支持的特性

  • 使用简单
  • 链式调用
  • 支持给iconfont左右设置文字
  • 支持xml中直接设置常用shape的所有属性
  • 支持渐变背景色,边线,纯色背景色,圆角等
  • 支持分别设置iconfont,左文字,右文字的颜色(Selector也可以)、字号、样式(粗体、斜体)
  • 支持左边文字,中间文字,右边文字都设置iconfont
  • 支持文字和iconfont居中
  • 支持左右文字设置多个span
  • 支持设置iconfont和左右文字的padding
  • 丰富的api,所有属性都支持xml和java调用

Download

Step1

Add it in your root build.gradle at the end of repositories:

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

Step2

Step 2. Add the dependency

dependencies {
		implementation 'com.github.DrownCoder:EasyTextView:v1.15'
	}

效果

自由发挥想象空间

使用

xml属性

<com.study.xuan.library.widget.EasyTextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="&#xe627;"
            android:textColor="#494949"
            android:textSize="14dp"
            app:iconColor="@android:color/holo_red_light"
            app:strokeColor="@android:color/holo_red_light"
            app:strokeWidth="1dp"
            app:textPadding="5dp"
            app:textRight="关注"
            app:totalRadius="12dp" />
<declare-styleable name="EasyTextView">
        //Shape中的Type:RECTANGLE:0(默认),OVAL(1),LINE(2)
        <attr name="shapeType" format="integer" />
        //四个角的圆角
        <attr name="totalRadius"  format="dimension"/>
        //左上角
        <attr name="topLeft" format="dimension"/>
        //左下角
        <attr name="bottomLeft" format="dimension"/>
        //右上角
        <attr name="topRight" format="dimension"/>
        //右下角
        <attr name="bottomRight" format="dimension"/>
        //边线的颜色
        <attr name="strokeColor"  format="color"/>
        //边线的宽度
        <attr name="strokeWidth" format="dimension" />
        //填充的颜色
        <attr name="soildBac" format="color"/>
        //中间的iconfont距离左右Text的内边距
        <attr name="textPadding" format="dimension"/>
        //左边的文字
        <attr name="textLeft" format="string"/>
        //右边的文字
        <attr name="textRight" format="string"/>
        //中间的iconfont的color(注意TextColor属性会覆盖)
        <attr name="iconColor" format="reference|color"/>
        //左边文字的color(注意TextColor属性会覆盖)
        <attr name="textLeftColor" format="reference|color"/>
        //右边文字的color(注意TextColor属性会覆盖)
        <attr name="textRightColor" format="reference|color"/>
        //左边文字的大小(iconfont的大小用TextSize即可,不会覆盖)
        <attr name="textLeftSize" format="dimension"/>
        //右边文字的大小(iconfont的大小用TextSize即可,不会覆盖)
        <attr name="textRightSize" format="dimension"/>
	//设置左边文字样式
	<attr name="textLeftStyle">
            <enum name="bold" value="1" />
            <enum name="italic" value="2" />
        </attr>
	//设置右边文字样式
        <attr name="textRightStyle">
            <enum name="bold" value="1" />
            <enum name="italic" value="2" />
        </attr>
	//设置中间文字样式
        <attr name="textCenterStyle">
            <enum name="bold" value="1" />
            <enum name="italic" value="2" />
        </attr>
        <attr name="autoMaxHeight" format="boolean" />
     //渐变色方向
        <attr name="gradientOrientation">
            <enum name="top_bottom" value="0" />
            <enum name="tp_bl" value="1" />
            <enum name="right_left" value="2" />
            <enum name="br_tl" value="3" />
            <enum name="bottom_top" value="4" />
            <enum name="bl_tr" value="5" />
            <enum name="left_right" value="6" />
            <enum name="tl_br" value="7" />
        </attr>
     //渐变色的起始色,中间色,末尾色
        <attr name="startSolid" format="reference|color" />
        <attr name="centerSolid" format="reference|color" />
        <attr name="endSolid" format="reference|color" />
    </declare-styleable>

java Api

//少属性可以直接设置
etvGet.setTextRight(已关注);
//多属性可以链式调用,减少重复绘制,节省性能,注意最后build()
etvGet.strokeWidth(DensityUtils.dp2px(context, 1))
                    .strokeColor(Color.parseColor("#ffe849"))
                    .solid(Color.parseColor("#e8264a"))
                    .icon(context.getText(R.string.icon_font_check).toString())
                    .textRight("关注").build();
/**
  * 非链式调用api
  */
public void setType(int type);
public void setStrokeWidth(int value);
public void setStrokeColor(@ColorInt int color);
public void setSolid(int soild);
public void setIconColor(int color);
public void setTextLeft(CharSequence textLeft);
public void setTextRight(CharSequence textRight);
public void setTextLeftColor(int color);
public void setTextRightColor(int color);
public void setTextLeftSize(float leftSize);
public void setTextRightSize(float rightSize);
public void setIcon(String iconText);
public EasyTextView textLeftStyle(int textLeftStyle);
public EasyTextView textRightStyle(int textRightStyle);
public EasyTextView textCenterStyle(int textCenterStyle);
public void clearSpan();
public void addSpanLeft(Object object, int start, int end, int flags);
public void addSpanLeft(List<Object> objects, int start, int end, int flags);
public void addSpanRight(List<Object> objects, int start, int end, int flags);
public void addSpanRight(Object object, int start, int end, int flags);

More

动态设置Shape,由SupperShape实现,可以动态通过java代码给任何View设置Shape,不需要再写shape.xml文件,欢迎使用。 本项目仅基于TextView进行封装,其他View可按照需求进行封装,原理比较简单,大家可以查看源码。  
详细使用说明参考Wiki

版本更新

v1.15

新增api修复左下和右下圆角颠倒的bug

v1.14

新增xml中支持设置渐变色

v1.13

1.修改icon类型从String改为charsequence 2.进一步拓展JAVA的API 3.补充Error信息

v1.12

1.修复center_vertical时文字重叠问题
2.新增boolean型autoMaxHeight属性,当为true时解决以下问题
-修复左右文字大小大于中间文字大小高度不准问题
-修复英文由于基线导致展示不全问题

v1.11

修复右侧文字颜色失效bug

v1.1

1.中间的文字支持字符串(原来只支持iconfont)
2.左边文字,中间文字,右边文字分别支持粗体和斜体
3.左边文字,中间文字,右边文字支持xml中设置iconfont(原来xml中只支持中间文字设置)
4.优化了代码

详细版本信息

License

Copyright 2017 [DrownCoder] 

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
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].