zoukankan      html  css  js  c++  java
  • android 实现在文本内容超过固定宽度可手动左右滚动查看效果

    实现类似于知乎中的个人签名,如上图中“知识需要分享,教育,健康”可以左右滑动效果。本来以为TextView包含这种属性,但是ellipsize =“none”并不能实现这种效果。

    所以想到使用EditText 来实现这种效果:
    <EditText
            android:id="@+id/et_test"
            android:layout_width="200.0dip"
            android:layout_height="wrap_content"
            android:background="@null"
            android:cursorVisible="false"
            android:focusable="false"
            android:singleLine="true"
            android:text="@string/str_test" />
    注意:设置focusable=“false”,否则会弹出软键盘

    顺便说一下TextView的跑马灯效果的实现:
     <TextView
            android:id="@+id/tv_thread"
            android:layout_width="200dip"
            android:layout_height="wrap_content"
            android:layout_marginBottom="50dip"
            android:ellipsize="marquee"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:marqueeRepeatLimit="marquee_forever"
            android:singleLine="true"
            android:text="@string/str_test" />






  • 相关阅读:
    shell练习题4
    shell练习题3
    shell练习题2
    shell练习题1
    Docker入门
    自动化运维之ansible
    自动化运维之Saltstack
    代码管理平台
    非关系统型数据库-mangodb
    2018-08-22 第三十五课
  • 原文地址:https://www.cnblogs.com/jinfenglee/p/4388707.html
Copyright © 2011-2022 走看看