现在的输出就像上面一样...不显示 SWITCH ..仅显示开/关
这是我的 Switch 代码...
所有其他设备输出都很好,但在 NExus 5 中它只显示开/关,而不是开关/切换开关。
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.7"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="Save recorded call? "
android:textColor="@color/black"
android:textStyle="bold" />
<Switch
android:id="@+id/recSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOff="Off"
android:textOn="On" />
</LinearLayout>
预先感谢您的帮助..建议可以接受..
最佳答案
添加你的依赖
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.3'
}
在你的 xml 中
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.7"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="Save recorded call? "
android:textColor="@color/black"
android:textStyle="bold" />
<android.support.v7.widget.SwitchCompat
android:id="@+id/switch_compat2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Switch Compat"
app:showText="false"/>
</LinearLayout>
关于android - 为什么 Switch 在 Nexus 5 版本 6.0.1 中显示不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38870900/