如何在Android中更改将文本切换到右侧? [英] How to change Switch text to right side in android?

查看:102
本文介绍了如何在Android中更改将文本切换到右侧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android默认Switch包含文本,然后打开/关闭Switch.我期望打开/关闭Switch,然后输入文字.请勿使用TextView之类的其他小部件.如何设置Switch右侧文本.

Android default Switch have text and then Switch on/off. I'm Expecting Switch on/off and then text. Don't use another widgets like TextView. How can i set Switch right side text.

推荐答案

将其包装在没有文本值的另一个布局中,并添加一个textview.看到我的代码:

Wrap it in another layout with no text value and add a textview. see my code:

    <LinearLayout
        android:layout_width="match_parent"
        android:orientation="horizontal"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"
        android:layout_height="wrap_content">
            <Switch
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/reminder" />
            <TextView
                android:layout_width="wrap_content"
                android:text="Meeting Reminders"
                android:layout_height="wrap_content" />
    </LinearLayout>

这篇关于如何在Android中更改将文本切换到右侧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆