All Projects → androiddevelop → Aligntextview

androiddevelop / Aligntextview

Licence: apache-2.0
字体对齐的textview

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Aligntextview

Gsyricktext
类似微博的emoji表情、@人、话题等的EdiText,优化了编辑框中的光标点击和删除处理。TextView支持emoji表情、话题、链接、电话和@某人特殊显示的文本。
Stars: ✭ 651 (-50.31%)
Mutual labels:  textview
Android Justifiedtextview
android justified textview
Stars: ✭ 917 (-30%)
Mutual labels:  textview
Android Material Design In Practice
A project to demonstrate the latest material design principles with simple examples. It has additional examples on how to easily scale texts on different screen sizes without extra effort.
Stars: ✭ 67 (-94.89%)
Mutual labels:  textview
Wmzdialog
功能最多样式最多的弹窗,支持普通/微信底部/日期/地区/日历/选择/编辑/分享/菜单/自定义弹窗等,支持多种动画,链式编程调用(Pop-up windows with the most functions and styles, support normal/WeChat bottom/date/region/calendar/select/edit/share/menu/custom pop-up windows, etc., support multiple animations, chain programming calls)
Stars: ✭ 673 (-48.63%)
Mutual labels:  textview
Rskgrowingtextview
A light-weight UITextView subclass that automatically grows and shrinks.
Stars: ✭ 820 (-37.4%)
Mutual labels:  textview
Linkifiedtextview
An extended TextView that allows you to detect several types of links such as urls, hashtags, phone numbers, etc.
Stars: ✭ 9 (-99.31%)
Mutual labels:  textview
Selectabletextview
A text view that supports selection and expansion
Stars: ✭ 626 (-52.21%)
Mutual labels:  textview
Leotextview
🐬A high-performance rich editor develop with swift on iOS platform, based on TextKit.
Stars: ✭ 87 (-93.36%)
Mutual labels:  textview
Roundprogresstextview
TextView with Round Pogress
Stars: ✭ 18 (-98.63%)
Mutual labels:  textview
Rwidgethelper
Android UI 快速开发,专治原生控件各种不服
Stars: ✭ 996 (-23.97%)
Mutual labels:  textview
Better Link Movement Method
Attempts to improve how clickable links are detected, highlighted and handled in TextView
Stars: ✭ 684 (-47.79%)
Mutual labels:  textview
Android Robototextview
Implementation of a TextView and all its direct/indirect subclasses with native support for the Roboto fonts, includes the brand new Roboto Slab fonts.
Stars: ✭ 791 (-39.62%)
Mutual labels:  textview
Omegaanimatedtext
Animate bold and italic transformations in TextView
Stars: ✭ 35 (-97.33%)
Mutual labels:  textview
Android Ago
An Android TextView that always displays an auto refreshing relative time span with respect to a reference time
Stars: ✭ 669 (-48.93%)
Mutual labels:  textview
Fole
Fole is a simple library to collapse and expand a TextView.
Stars: ✭ 67 (-94.89%)
Mutual labels:  textview
Expandabletextview
Android TextView that can expand and collapse.
Stars: ✭ 632 (-51.76%)
Mutual labels:  textview
Justifytextview
Deprecated
Stars: ✭ 25 (-98.09%)
Mutual labels:  textview
Tagging
A TextView that provides easy to use tagging feature for Mention or Hashtag
Stars: ✭ 91 (-93.05%)
Mutual labels:  textview
Ariana
Provide Multiple Gradients in ImageViews and Texts. Integrate with ViewPager to change colors dynamically.
Stars: ✭ 74 (-94.35%)
Mutual labels:  textview
Expandabletextview
实现类似微博内容,@用户,链接高亮,@用户和链接可点击跳转,可展开和收回的TextView
Stars: ✭ 992 (-24.27%)
Mutual labels:  textview

AlignTextView

字体对齐的TextView

Maven Central

截图

系统要求

Android 4.0以上

快速使用

build.gradle加入dependencies

compile 'me.codeboy.android:align-text-view:2.3.2'

AlignTextView (不支持选择复制,在不需要进行选择复制的情况下使用,排版效果好)

 <me.codeboy.android.aligntextview.AlignTextView
        android:id="@+id/alignTv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

CBAlignTextView (新的版本,支持选择复制,排版效果比较的好)

<me.codeboy.android.aligntextview.CBAlignTextView
        android:id="@+id/cbAlignTv"
        android:textIsSelectable="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

如果需要支持android默认的选择复制,请在xml中加入以下代码:

android:textIsSelectable="true"

相关方法

1.CBAlignTextView

CBAlignTextView中增加了以下方法获取TextView的文本内容,请不要使用getText()获取

getRealText()

由于Android L(5.0)之后对中文的版本进行了变化,造成不能由中文标点作为行首,所以为了能够使CBAlignTextView看起来更加工整,建议将中文符号用英文符号替换(默认不转换),可以通过以下三种方式转化

  • 使用转化函数转化标点符号:

     CBAlignTextViewUtil.replacePunctuation(String text)
    
  • 在设置CBAlignTextView文本前(setText),调用以下方法:

     setPunctuationConvert(boolean convert)
    
  • 如果需要多次设置文本,或者复用组件(如RecyclerView中),在后面每次设置文本前,请调用以下方法:

    reset()
    
  • 可以直接在xml布局中进行设置

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:cb="http://schemas.android.com/apk/res-auto"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:orientation="vertical">
       <me.codeboy.android.aligntextview.CBAlignTextView
             android:id="@+id/cbAlignTextView"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             cb:punctuationConvert="true"
             android:textIsSelectable="true"
             android:textSize="14dsp"/>    
     </LinearLayout>
    

2.AlignTextView

AlignTextView是旧的版本,不支持选择复制,但是可以自定义最后一行的对齐方式

setAlign(Align align)

设置每一段最后一行对齐方式,默认居左对齐,同时也可以在xml注释中设置对其方式:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical">
  <me.codeboy.android.aligntextview.AlignTextView
        android:id="@+id/alignTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        cb:align="center"
        android:textSize="14dsp"/>    
</LinearLayout>

使用说明

  1. 不用进行选择复制的时候使用 AlignTextView,需要进行选择复制的时候使用CBAlignTextView
  2. AlignTextViewCBAlignTextView在对齐的时候不会对英文单词等进行考虑,它们都是以字符(character)为基础的,不是词(word)。
  3. 使用CBAlignTextView时建议进行中文标点的转换。
  4. demo项目位与app下,可以单独提取出me.codeboy.android.aligntextview.AlignTextView和me.codeboy.android.aligntextview.CBAlignTextView使用。

更新历史

v2.3.2

  1. 修复CBAlignTextView多次设置文本后空行的问题。

v2.3.1

  1. 修复CBAlignTextView在xml中设置text时空指针问题。
  2. 修复CBAlignTextView设置空文本无效问题。

License

Copyright 2016 Yuedong.li

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.

有任何问题,欢迎发送邮件到[email protected]交流.

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].