中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Android自定義View系列之可伸縮的TextView

發布時間:2020-08-18 13:13:29 來源:網絡 閱讀:515 作者:ceshiceshibaba 欄目:移動開發

經常訪問我博客的同學應該注意到了我的博客大部分是關于分析Android系統原理的,很少涉及應用層的知識,但是想要開發一個用戶歡迎的App,沒有一個炫酷的UI肯定是不行的,就好比一個人想成為武林高手僅僅修煉內功是不行的,必須內功和外功同時修煉才能成為真正的武林高手。很多人在開發Android的App過程中有這樣的感覺,我不用學習Android系統原理照樣可以進行Android開發,而且可以做出非常炫酷的效果,確實是這樣的 ,因為對于一款App,它的大部分需求無非就是請求數據然后展示數據,至于一些炫酷的UI控件網上有很多開源的,所以我們不用懂Android系統的原理同樣可以進行App開發,相信你自己也發現了,長期做這樣的工作,你的技術是永遠得不到提升的,當你使用別人開源的炫酷的控件時,你并不知道別人是怎么實現的,即使你有興趣看別人的實現方法,如果你不懂Android系統原理,估計你也看不懂別人為什么要這么做。所以從今天起的半年時間,我會將學習重點放在應用層的開發,主要是自定義View和炫酷的動畫的學習上。


該自定義View具備如下特性:

  1. 當顯示的內容沒有2行(可以通過屬性配置)時,和普通的TextView一樣

  2. 當顯示的內容大于2行時,僅僅顯示兩行,并且沒有顯示完的內容使用省略號代替,并顯示向下箭頭表示還有內容沒有顯示全

  3. 當用戶點擊TextView時,內容全部展開,當用戶再次點擊時,TextView又變為壓縮模式

下面我們開始代碼實現,正如上面所說,此View支持自定義屬性,所以我們先要定義attrs.xml文件,如何編寫attrs.xml文件網上有很多教程,我這里就不在說了。

<?xml version="1.0" encoding="utf-8"?><resources>
    <declare-styleable name="ExpandTextView">
        <attr name="textcolor" format="color"></attr>
        <attr name="textsize" format="dimension"></attr>
        <attr name="icon" format="reference"></attr>
        <attr name="lines" format="integer"></attr>
        <attr name="text" format="string"></attr>
    </declare-styleable></resources>12345678910

這幾個屬性的意義如下:

  • textcolor : 字體顏色

http://www.gexing.com/tupian/t/%E5%8D%97%E9%95%BF%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700

http://www.gexing.com/tupian/t/%E8%92%99%E8%87%AA%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700/good/

http://www.gexing.com/tupian/t/%E6%97%8C%E9%98%B3%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700

http://www.gexing.com/tupian/t/%E6%B8%AF%E5%8F%A3%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700/good/

http://www.gexing.com/tupian/t/%E8%99%9E%E5%9F%8E%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700

http://www.gexing.com/tupian/t/%E6%98%AD%E5%B9%B3%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E9%93%B6%E6%B5%B7%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700

http://www.gexing.com/tupian/t/%E5%AE%89%E6%96%B0%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700

http://www.gexing.com/tupian/t/%E7%BA%A2%E5%B1%B1%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%9B%BA%E9%98%B3%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700

http://www.gexing.com/tupian/t/%E5%87%8C%E6%B2%B3%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E7%A7%80%E8%8B%B1%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700

http://www.gexing.com/tupian/t/%E7%BA%A2%E5%B1%B1%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E8%92%99%E5%B1%B1%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700

http://www.gexing.com/tupian/t/%E6%9E%9E%E9%98%B3%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700/good/

http://www.gexing.com/tupian/t/%E9%87%91%E6%B2%99%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700

http://www.gexing.com/tupian/t/%E9%93%81%E8%A5%BF%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700/good/

http://www.gexing.com/tupian/t/%E7%91%9E%E9%87%91%E5%B8%82%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700

http://www.gexing.com/tupian/t/%E5%AE%89%E5%8C%96%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E4%B9%BE%E5%AE%89%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700

http://www.gexing.com/tupian/t/%E6%B8%85%E6%B2%B3%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E4%B8%B0%E9%A1%BA%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700/good/

http://www.gexing.com/tupian/t/%E9%97%B8%E5%8C%97%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700

http://www.gexing.com/tupian/t/%E4%B8%9C%E5%85%B4%E5%B8%82%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700/good/

http://www.gexing.com/tupian/t/%E9%A2%8D%E4%B8%8A%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700

http://www.gexing.com/tupian/t/%E9%87%91%E6%B2%99%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700

http://www.gexing.com/tupian/t/%E6%B2%85%E9%99%B5%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700/good/

http://www.gexing.com/tupian/t/%E9%83%8A%E3%80%80%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700

http://www.gexing.com/tupian/t/%E5%8D%AB%E4%B8%9C%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700/good/

http://www.gexing.com/tupian/t/%E6%96%B0%E9%82%B1%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E5%BC%A0%E5%BA%97%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%AE%81%E6%98%8E%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700

http://www.gexing.com/tupian/t/%E5%8F%8B%E8%B0%8A%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E7%91%9E%E5%AE%89%E5%B8%82%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E6%B8%85%E5%9F%8E%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%AE%81%E6%B5%B7%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E5%9B%9B%E5%B9%B3%E5%B8%82%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700/good/

http://www.gexing.com/tupian/t/%E7%9B%98%E5%B1%B1%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700

http://www.gexing.com/tupian/t/%E4%B8%9C%E5%AE%81%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E6%B2%99%E6%B4%8B%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%AE%9C%E5%B7%9D%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E5%AF%9F%E9%9B%85%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%91%A8%E5%AE%81%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E5%90%88%E5%B1%B1%E5%B8%82%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700/good/

http://www.gexing.com/tupian/t/%E8%B5%84%E9%98%B3%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%AE%9C%E7%AB%A0%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E7%8F%A0%E6%99%96%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E7%BA%A2%E5%8E%9F%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700

http://www.gexing.com/tupian/t/%E6%99%AE%E5%85%B0%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E8%BE%BD%E6%BA%90%E5%B8%82%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700

http://www.gexing.com/tupian/t/%E5%B9%B3%E6%9E%9C%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700/good/

http://www.gexing.com/tupian/t/%E8%B5%84%E5%85%B4%E5%B8%82%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E6%A6%86%E4%B8%AD%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700/good/

http://www.gexing.com/tupian/t/%E6%B5%B7%E5%8E%9F%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700/good/

http://www.gexing.com/tupian/t/%E7%83%9F%E5%8F%B0%E5%B8%82%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700/good/

http://www.gexing.com/tupian/t/%E8%82%A5%E5%9F%8E%E5%B8%82%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700

http://www.gexing.com/tupian/t/%E4%B8%B9%E5%87%A4%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700/good/

http://www.gexing.com/tupian/t/%E6%B5%B7%E6%B8%AF%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700

http://www.gexing.com/tupian/t/%E5%8C%97%E6%B5%B7%E5%B8%82%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700/good/

http://www.gexing.com/tupian/t/%E7%A7%80%E6%B4%B2%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700

http://www.gexing.com/tupian/t/%E8%A1%A2%E6%B1%9F%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700

http://www.gexing.com/tupian/t/%E8%A1%A2%E6%B1%9F%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700/good/

http://www.gexing.com/tupian/t/%E4%B8%9C%E5%B1%B1%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700

http://www.gexing.com/tupian/t/%E4%BC%9A%E5%90%8C%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%87%8C%E6%B2%B3%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700

http://www.gexing.com/tupian/t/%E4%BF%AE%E6%AD%A6%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700

http://www.gexing.com/tupian/t/%E5%90%89%E6%9E%97%E5%B8%82%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700/good/

http://www.gexing.com/tupian/t/%E7%BD%97%E6%B1%9F%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%A3%A4%E5%A1%98%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E4%BA%91%E9%BE%99%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700/good/

http://www.gexing.com/tupian/t/%E6%A1%91%E6%A4%8D%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700

http://www.gexing.com/tupian/t/%E9%A9%AC%E6%9D%91%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E4%B8%81%E9%9D%92%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700/good/

http://www.gexing.com/tupian/t/%E6%9F%8F%E4%B9%A1%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700

http://www.gexing.com/tupian/t/%E9%BE%99%E6%B2%99%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%B9%B3%E6%9E%9C%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%A8%81%E4%BF%A1%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E8%82%A5%E8%A5%BF%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E8%B4%B5%E5%8D%97%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700/good/

http://www.gexing.com/tupian/t/%E6%A1%90%E6%A2%93%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700

http://www.gexing.com/tupian/t/%E5%BC%80%E6%B1%9F%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700

http://www.gexing.com/tupian/t/%E4%B9%90%E5%B9%B3%E5%B8%82%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%AE%9C%E5%85%B4%E5%B8%82%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700

http://www.gexing.com/tupian/t/%E6%B7%AE%E9%98%B4%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E5%8F%8B%E5%A5%BD%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700/good/

http://www.gexing.com/tupian/t/%E6%9F%B3%E6%9E%97%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700

http://www.gexing.com/tupian/t/%E5%AE%9D%E5%BA%94%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E7%AB%8B%E5%B1%B1%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700

http://www.gexing.com/tupian/t/%E8%9D%B6%E5%B1%B1%E5%8C%BA%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E8%8D%A3%E6%98%8C%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700/good/

http://www.gexing.com/tupian/t/%E4%B8%AD%E7%89%9F%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700

http://www.gexing.com/tupian/t/%E9%AB%98%E9%9D%92%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700/good/

http://www.gexing.com/tupian/t/%E8%B4%B5%E9%98%B3%E5%B8%82%E5%A4%A7%E5%9C%A3%E6%80%BB%E4%BB%A3QQ82933700

http://www.gexing.com/tupian/t/%E5%B0%A4%E6%BA%AA%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%BC%A5%E5%8B%92%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700

http://www.gexing.com/tupian/t/%E7%8F%99%E3%80%80%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%AE%89%E5%B2%B3%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%B9%B3%E5%8F%B0QQ82933700/good/

http://www.gexing.com/tupian/t/%E7%BC%99%E4%BA%91%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%A8%B1%E4%B9%90QQ82933700/good/

http://www.gexing.com/tupian/t/%E9%B9%BF%E9%82%91%E5%8E%BF%E5%A4%A7%E5%9C%A3%E5%BD%A9%E7%A5%A8QQ82933700

http://www.gexing.com/tupian/t/%E6%B0%B8%E5%BE%B7%E5%8E%BF%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700/good/

http://www.gexing.com/tupian/t/%E5%BC%A0%E6%B9%BE%E5%8C%BA%E5%A4%A7%E5%9C%A3%E6%8B%9B%E5%95%86QQ82933700



向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

扶沟县| 辛集市| 乐东| 西平县| 英山县| 宁海县| 武鸣县| 上栗县| 花垣县| 突泉县| 酒泉市| 信宜市| 新疆| 图木舒克市| 丽江市| 花莲市| 灵川县| 建昌县| 大新县| 阿图什市| 石城县| 山阳县| 安国市| 永嘉县| 谷城县| 绥阳县| 班玛县| 昌图县| 鞍山市| 阳原县| 灵寿县| 营山县| 连州市| 太和县| 穆棱市| 永丰县| 昌邑市| 长垣县| 隆子县| 平昌县| 高阳县|