Code Monkey home page Code Monkey logo

edittext-weibo-topic's Introduction

EditText-weibo-topic

在EditText中仿weibo发布#话题文字#作者给出两种较好方案: 1、一种是自定义hint,采用一个EditText布局,通过拼接字符串控制 ##+content。 优点在于:1、可以添加多个@##类似标签。2、支持整体删除功能。3、方便获取文本内容 存在的主要问题是:1、光标可以运动到hint文字中,不满足需求。2、自定义hint逻辑复杂,可扩展行不好,通过长按出现的箭头将光标移动到hint文字或者话题文字**,在 addTextChangedListener 的 afterTextChange 方法里改变文本时,会因为循环调用 StackOverFlow,可以通过变量开关或者其它监听事件解决。 2、使用叠加布局,TextView显示##,EditText通过marginLeft,留出话题文字的长度。 存在的主要问题:1、marginLeft的数值与Layout.getDesiredWidth获取的数值有偏差。当换行的时候,第一行使用话题文字填充的大小不确定。不同类型的的主题文字效果不同。2、EditText必须设置android:background="@null",去掉边框,TextView和EditText的高度无法精确对齐。 优点在于:1、hint系统自带,逻辑简单清晰。2、 ##标题标签永远不可编辑。

edittext-weibo-topic's People

Contributors

arthurlang avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.