交换机的问题 - 只有一个选项可见只有一个、交换机、选项、问题

2023-09-07 23:04:09 作者:青丝绾

我想在Android应用程序中使用的开关。我尝试过,但主要的问题是

I want to use switch in an android application. I tried it but main issue is

如果我选择ON,则不会显示了文字。如果我选择了关闭,它不会在文本显示。

关文本,但我们可以通过点击开关的黑色区域选择OFF。

Off text is not displayed but we can select OFF by clicking in black area of switch.

code

<Switch android:id="@+id/mySwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="48dp"
android:layout_marginTop="26dp"
android:height="50dp"
android:text="ON OFF"
android:textSize="20sp"
android:switchMinWidth="50sp"
android:switchPadding="50sp"/>

在国家

关机状态

我怎么可以显示在同一时间两个文本?我可以改变开关的文本两种状态ON / OFF?

How i can display both text at the same time? Can i change text of switch for both state ON/OFF?

任何帮助,将AP preciated。

Any Help would be appreciated.

先谢谢了。

推荐答案

通过这个链接进入。这是一个好的图书馆,你可以通过code,并找出如何通过自己或使用该库,因为它是。

Go through this link. It is a good library, you can go through the code and find out how by yourself or use the library as it is.