我只想在线性布局中添加一个默认开关,但这看起来就像一个切换按钮。
我的开关:
<Switch
android:id="@+id/switch1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textOn="ON"
android:textOff="OFF"
android:text="Switch: "
android:textColor="@color/text_color"/>
我的依赖项:
dependencies {
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation "com.android.support:appcompat-v7:27.1.1"
}
样式无效
style =“ @ style / Theme.AppCompat”
出什么问题了?
编辑:
我的Style.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="theme" parent="@android:style/Theme.NoTitleBar">
<item name="android:tabWidgetStyle">@style/tabWidget</item>
<item name="android:alertDialogStyle">@style/dialog</item>
</style>
<style name="tabWidget" parent="@android:style/Widget.TabWidget">
</style>
<style name="dialog" parent="@android:style/Theme.Dialog">
</style>
<!-- -->
<style name="dialog_text">
<item name="android:textColor">#000000</item>
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
</style>
<style name="outer_text">
<item name="android:textColor">#ffffff</item>
</style>
<style name="dialog_label">
<item name="android:textColor">#000000</item>
<item name="android:layout_width">105dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
</style>
<style name="menu_labels_style">
<item name="android:background">@drawable/fab_label_background</item>
<item name="android:textColor">@color/white</item>
</style>
</resources>