【问题标题】:Dynamic underlined letters [closed]动态下划线字母[关闭]
【发布时间】:2017-10-29 00:45:59
【问题描述】:

我想要一个具有不同外观的文本视图(下划线只是准确的)有人可以帮助我如何实现这一点。我在 xamarin android 中做这件事。

【问题讨论】:

    标签: android xml xamarin.android


    【解决方案1】:

    你可以用shape画一条线。

    1.shape_line.xml

    您可以更改android:width 和android:height。

    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <solid android:color="@android:color/white" />
        <padding android:top="10dp" />
        <size
           android:width="60dp"
           android:height="10dp" />
    </shape>
    

    2.这样使用。

    editText = (EditText) findViewById(R.id.et);
    editText.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, R.drawable.shape_line);
    

    3.如果你使用EditText,你应该设置android:background="@null",否则底部会有颜色。

     <EditText
        android:id="@+id/et"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:background="@null"
        android:gravity="center"
        android:text="N"
        android:textColor="@android:color/white" />
    

    输出

    【讨论】:

    • 我现在不能尝试,但我一定会尝试的。谢谢!
    • 祝你好运。
    • 成功了。谢谢!
    猜你喜欢
    • 2013-12-19
    • 1970-01-01
    • 1970-01-01
    • 2011-07-06
    • 1970-01-01
    • 2014-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-07
    相关资源
    最近更新 更多