Android中TextView设置下划线


如图:

 

 

设置 android:autoLink="all"

<TextView
                android:id="@+id/tv_change_wifi"
                android:layout_width="wrap_content"
                android:layout_height="14dp"
                android:layout_marginRight="20dp"
                android:autoLink="all"
                android:text="切换网络"
                android:textColor="#5074E6"
                android:textSize="12sp"
                android:background="@drawable/ezviz_change_network_bg"></TextView>

  设置背景颜色: android:background="@drawable/ezviz_change_network_bg"

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- 边框颜色值 -->
    <item>
        <shape>
            <solid android:color="#5074E6" /><!--下划线颜色-->
        </shape>
    </item>
    <item android:bottom="1dp"> <!--下划线厚度-->
        <shape>
            <solid android:color="#EEEEEE" /><!--背景色 不能透明否则会显示上面的下划线颜色-->
        </shape>
    </item>
</layer-list>

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM