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