switch_preference_with_settings.xml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- Copyright (C) 2018 The Android Open Source Project
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. -->
  13. <LinearLayout
  14. xmlns:android="http://schemas.android.com/apk/res/android"
  15. android:layout_width="wrap_content"
  16. android:layout_height="wrap_content"
  17. android:orientation="horizontal"
  18. android:gravity="center_vertical">
  19. <ImageView
  20. android:id="@+id/settings"
  21. android:layout_width="wrap_content"
  22. android:layout_height="wrap_content"
  23. android:src="@drawable/ic_setting"
  24. android:forceDarkAllowed="true"
  25. android:padding="12dp"
  26. android:background="?android:attr/selectableItemBackgroundBorderless" />
  27. <View
  28. android:id="@+id/divider"
  29. android:layout_width="1dp"
  30. android:layout_height="30dp"
  31. android:layout_marginEnd="8dp"
  32. android:background="?android:attr/listDivider" />
  33. <!-- Note: seems we need focusable="false" and clickable="false" when moving to androidx -->
  34. <Switch
  35. android:id="@android:id/switch_widget"
  36. android:layout_width="wrap_content"
  37. android:layout_height="wrap_content"
  38. android:background="@null" />
  39. </LinearLayout>