mirror of
https://github.com/material-components/material-components-android.git
synced 2026-02-20 08:39:55 +08:00
[Catalog] Update Catalog preferences demo to use MaterialSwitch
Related to https://github.com/material-components/material-components-android/issues/2828 PiperOrigin-RevId: 464830220
This commit is contained in:
parent
5c6f0c8b99
commit
229eb9d64f
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- Layout used by SwitchPreference for the switch widget style. This is inflated
|
||||
inside android.R.layout.preference. -->
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/switchWidget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:clickable="false"
|
||||
android:background="@null"/>
|
||||
@ -17,6 +17,7 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<style name="Theme.Catalog" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<item name="preferenceTheme">@style/CatalogPreferenceThemeOverlay</item>
|
||||
<item name="catalogToolbarStyle">@style/Widget.Catalog.Toolbar</item>
|
||||
<item name="catalogToolbarWithCloseButtonStyle">@style/Widget.Catalog.Toolbar.WithCloseButton</item>
|
||||
<item name="textInputSignInStyle">@style/Widget.Material3.TextInputLayout.OutlinedBox</item>
|
||||
@ -28,4 +29,12 @@
|
||||
<item name="android:statusBarColor" tools:targetApi="21">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="CatalogPreferenceThemeOverlay" parent="PreferenceThemeOverlay">
|
||||
<item name="switchPreferenceCompatStyle">@style/Preference.SwitchPreferenceCompat.Catalog</item>
|
||||
</style>
|
||||
|
||||
<style name="Preference.SwitchPreferenceCompat.Catalog" parent="Preference.SwitchPreferenceCompat.Material">
|
||||
<item name="android:widgetLayout">@layout/preference_widget_material_switch</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user