【问题标题】:How do you create a 'read more' layout in Android?如何在 Android 中创建“阅读更多”布局?
【发布时间】:2015-05-14 13:20:39
【问题描述】:

我想在获取到的文字增加到一定限度时显示一个“阅读全文”的链接,这样如果用户想详细阅读,就可以像Play Store的应用安装页面一样点击阅读全文

请建议我如何实现这一点

【问题讨论】:

标签: android


【解决方案1】:

你可以参考这个。 git hub 上可用的布局

https://github.com/traex/ExpandableLayout

【讨论】:

    【解决方案2】:

    谢谢大家的回答,我是这样解决的。 有一个属性叫android:maxLines="" 使用这个属性,我们可以在文本视图下方添加阅读更多文本视图,使其可点击,这样当用户点击文本视图时,我们可以执行我们想要的任何操作 示例:

    <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:text="Device supports NFS etc....."
            android:maxLines="4"
            android:id="@+id/description" />
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="Read More"
            android:layout_gravity="center_horizontal"
            android:textColor="#0066FF"
            android:id="@+id/readmore" />
    

    我希望这会有所帮助。

    【讨论】:

      【解决方案3】:

      看起来像在谷歌播放这个链接打开其他活动。因此,它只是具有 startActivity() 行为的按钮。

      【讨论】:

      • 这应该是评论而不是答案,请删除它
      • @Ed 在我看来他实际上是在给出答案。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-07-02
      • 1970-01-01
      • 1970-01-01
      • 2017-03-30
      • 1970-01-01
      • 2013-03-04
      • 1970-01-01
      相关资源
      最近更新 更多