Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Slider] Track icon tinting attributes tint icons globally #4520

Closed
pubiqq opened this issue Jan 2, 2025 · 1 comment
Closed

[Slider] Track icon tinting attributes tint icons globally #4520

pubiqq opened this issue Jan 2, 2025 · 1 comment
Assignees

Comments

@pubiqq
Copy link
Contributor

pubiqq commented Jan 2, 2025

Source code:

cat_slider_demo_icon.xml

<?xml version="1.0" encoding="utf-8"?><!--
  Copyright 2024 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.
  -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="16dp"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:orientation="vertical">

    <com.google.android.material.slider.Slider
      android:id="@+id/slider_icon_start"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginTop="32dp"
      android:layout_gravity="center"
      android:value="8.00"
      android:valueFrom="0.0"
      android:valueTo="11.0"
      app:thumbHeight="48dp"
      app:trackCornerSize="12dp"
      app:trackHeight="40dp"
      app:trackIconActiveColor="@color/yellow_500"
      app:trackIconActiveStart="@drawable/baseline_music_note_24"
      app:trackIconInactiveColor="@color/m3_ref_palette_green50"
      app:trackIconInactiveStart="@drawable/baseline_music_off_24"
      app:trackIconSize="20dp" />

    <com.google.android.material.slider.Slider
      android:id="@+id/slider_icon_end"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginTop="32dp"
      android:layout_gravity="center"
      android:value="8.00"
      android:valueFrom="0.0"
      android:valueTo="11.0"
      app:thumbHeight="48dp"
      app:trackCornerSize="12dp"
      app:trackHeight="40dp"
      app:trackIconActiveColor="@color/m3_ref_palette_orange70"
      app:trackIconActiveEnd="@drawable/baseline_music_note_24"
      app:trackIconInactiveColor="@color/blue_700"
      app:trackIconInactiveEnd="@drawable/baseline_music_off_24"
      app:trackIconSize="20dp"
      app:trackStopIndicatorSize="0dp" />

    <com.google.android.material.slider.Slider
      android:id="@+id/slider_icon_start_end"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginTop="32dp"
      android:layout_gravity="center"
      android:value="8.00"
      android:valueFrom="0.0"
      android:valueTo="11.0"
      app:thumbHeight="48dp"
      app:trackCornerSize="12dp"
      app:trackHeight="40dp"
      app:trackIconActiveColor="@color/red_500"
      app:trackIconActiveEnd="@drawable/baseline_music_note_24"
      app:trackIconActiveStart="@drawable/avd_clock_alarm"
      app:trackIconInactiveColor="@color/m3_ref_palette_purple40"
      app:trackIconInactiveEnd="@drawable/baseline_music_off_24"
      app:trackIconInactiveStart="@drawable/avd_clock_clock"
      app:trackIconSize="20dp"
      app:trackStopIndicatorSize="0dp" />
  </LinearLayout>
</ScrollView>

Result:

31-84.mp4

Material Library version: 1.13.0-alpha09

Device: API 28 Emulator

@paulfthomas
Copy link
Member

9ce14ae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants