zoukankan      html  css  js  c++  java
  • TextView 图片居右

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="@color/bg_home">
        <TextView
            android:text="设置"
            android:textSize="14sp"
            android:textColor="@color/code08"
            android:layout_marginTop="10dp"
            android:background="@color/white"
            android:drawableLeft="@drawable/home_setting"
            style="@style/my_textview_style"
            />
    </LinearLayout>
    <style name="my_textview_style">
            <item name="android:layout_width">match_parent</item>
            <item name="android:layout_height">50dp</item>
            <item name="android:paddingLeft">10dp</item>
            <item name="android:paddingRight">10dp</item>
            <item name="android:paddingTop">10dp</item>
            <item name="android:paddingBottom">10dp</item>
            <item name="android:textSize">14sp</item>
            <item name="android:background">@drawable/btn_transfer_selector</item>
            <item name="android:clickable">true</item>
            <item name="android:drawableRight">@drawable/home_left_jt</item>
            <item name="android:drawablePadding">14dp</item>
            <item name="android:gravity">center_vertical|left</item>
     </style>

    TextView 的宽是填充父窗体 , TextView的drawableLeft 属性的位置是Textview的的最左边   drawableRignt 在TextView的最右边所有。

    如果你将TextView的宽改为 wrap_content 那么最右边的小三角将紧靠设置这两个文字。

  • 相关阅读:
    题解 CF702F 【T-Shirts】
    题解 CF914G 【Sum the Fibonacci】
    CF258D 【Little Elephant and Broken Sorting】
    socket 私有服务端验证方法
    Gateway + Oauth2 + Security认证与授权 [更新中]
    串并转换和并串转换
    序列检测机【转】
    浮点数的定点化
    Verilog实现同步FIFO和异步FIFO
    频率检测计
  • 原文地址:https://www.cnblogs.com/androidsj/p/4923799.html
Copyright © 2011-2022 走看看