最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android開發(fā)實現(xiàn)的文本折疊點擊展開功能示例

 更新時間:2019年03月25日 12:08:34   作者:水中魚之1999  
這篇文章主要介紹了Android開發(fā)實現(xiàn)的文本折疊點擊展開功能,涉及Android界面布局與屬性控制相關操作技巧,需要的朋友可以參考下

本文實例講述了Android開發(fā)實現(xiàn)的文本折疊點擊展開功能。分享給大家供大家參考,具體如下:

信息欄,景點介紹,購物信息,進場會使用到文本折疊的方法

實現(xiàn)非常簡單,這里就不哆嗦了

效果如下:

Demo:https://github.com/LonglyWolf/NavigationSystemHLJU

這里用到了三方類庫,在app/gradle添加依賴如下:

//文本過長 點擊展開全部
implementation 'com.ms-square:expandableTextView:0.1.4'

上面的實例是通過adapter就和listView實現(xiàn)的,這里就不搞那么復雜,直接看折疊文本的方法實現(xiàn):

首先是主活動:

@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // sample code snippet to set the text content on the ExpandableTextView
    ExpandableTextView expTv1 = (ExpandableTextView) findViewById(R.id.expand_text_view);
    // IMPORTANT - call setText on the ExpandableTextView to set the text content to display
    expTv1.setText("qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq");
  }

重點在于布局文件的設置:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/container"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  tools:context=".MainActivity">
  <com.ms.square.android.expandabletextview.ExpandableTextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
    android:id="@+id/expand_text_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    expandableTextView:maxCollapsedLines="4"
    expandableTextView:animDuration="200">
    <TextView
      android:id="@id/expandable_text"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginLeft="10dp"
      android:layout_marginRight="10dp"
      android:textSize="16sp"
      android:textColor="#666666" />
    <ImageButton
      android:id="@id/expand_collapse"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:padding="16dp"
      android:layout_gravity="right|bottom"
      android:background="@android:color/transparent"/>
  </com.ms.square.android.expandabletextview.ExpandableTextView>
</LinearLayout>

更多關于Android相關內容感興趣的讀者可查看本站專題:《Android控件用法總結》、《Android開發(fā)入門與進階教程》、《Android視圖View技巧總結》、《Android編程之a(chǎn)ctivity操作技巧總結》、《Android數(shù)據(jù)庫操作技巧總結》及《Android資源操作技巧匯總

希望本文所述對大家Android程序設計有所幫助。

相關文章

  • Android Studio多渠道打包的配置方法

    Android Studio多渠道打包的配置方法

    今天小編就為大家分享一篇關于Android Studio多渠道打包的配置方法,小編覺得內容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧
    2018-12-12
  • Android AOP注解Annotation詳解(一)

    Android AOP注解Annotation詳解(一)

    這篇文章主要介紹了Android AOP注解Annotation詳細介紹的相關資料,Annotation是代碼里的特殊標記,這些標記可以在編譯、類加載、運行時被讀取,并執(zhí)行相應的處理,需要的朋友可以參考下
    2017-03-03
  • 通過WIFI(不用數(shù)據(jù)線)連接Android手機調試

    通過WIFI(不用數(shù)據(jù)線)連接Android手機調試

    本文主要介紹WIFI 鏈接手機調試,這里詳細介紹了WIFI 鏈接Android手機實現(xiàn)調試的過程,有需要的小伙伴可以參考下
    2016-08-08
  • Android實現(xiàn)動態(tài)高斯模糊效果示例代碼

    Android實現(xiàn)動態(tài)高斯模糊效果示例代碼

    這篇文章主要介紹了Android快速實現(xiàn)動態(tài)模糊效果示例代碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下。
    2017-01-01
  • Android TextView顯示html樣式的文字

    Android TextView顯示html樣式的文字

    這篇文章主要介紹了Android TextView顯示html樣式的文字的相關資料,需要的朋友可以參考下
    2016-01-01
  • Android ScrollView實現(xiàn)橫向和豎向拖動回彈效果

    Android ScrollView實現(xiàn)橫向和豎向拖動回彈效果

    這篇文章主要為大家詳細介紹了Android ScrollView實現(xiàn)橫向和豎向拖動回彈效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-09-09
  • Android之RecyclerView實現(xiàn)時光軸效果示例

    Android之RecyclerView實現(xiàn)時光軸效果示例

    本篇文章主要介紹了Android之RecyclerView實現(xiàn)時光軸效果,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-02-02
  • 使用Glide實現(xiàn)高斯模糊效果

    使用Glide實現(xiàn)高斯模糊效果

    這篇文章主要為大家詳細介紹了使用Glide實現(xiàn)高斯模糊效果,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2020-12-12
  • Android中Parcelable的使用詳解

    Android中Parcelable的使用詳解

    Serializable是Java為我們提供的一個標準化的序列化接口。而Parcelable是Android為我們提供的序列化的接口。 這篇文章主要介紹了Android中Parcelable的使用 ,需要的朋友可以參考下
    2019-06-06
  • Android實現(xiàn)購物車添加商品動畫

    Android實現(xiàn)購物車添加商品動畫

    這篇文章主要為大家詳細介紹了Android實現(xiàn)購物車添加商品動畫,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-06-06

最新評論

乌恰县| 城步| 合山市| 莱芜市| 平遥县| 沧州市| 迭部县| 麦盖提县| 沽源县| 宁城县| 托克托县| 浦城县| 安图县| 奎屯市| 上饶市| 大厂| 永春县| 板桥市| 若尔盖县| 进贤县| 昆明市| 大石桥市| 乐东| 惠水县| 高州市| 平度市| 三江| 库伦旗| 汝阳县| 平武县| 郸城县| 日照市| 伽师县| 交口县| 张掖市| 格尔木市| 读书| 乐安县| 临高县| 淅川县| 浪卡子县|