• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2Android DrawableTinting Sample
3===================================
4
5Sample that shows applying tinting and color filters to Drawables both programmatically
6and as Drawable resources in XML.
7
8Tinting is set on a nine-patch drawable through the "tint" and "tintMode" parameters.
9A color state list is referenced as the tint color, which defines colors for different
10states of a View (for example disabled/enabled, focused, pressed or selected).
11
12Programmatically, tinting is applied to a Drawable through its "setColorFilter" method,
13with a reference to a color and a PorterDuff blend mode. The color and blend mode can be
14changed from the UI to see the effect of different options.
15
16Pre-requisites
17--------------
18
19- Android SDK 28
20- Android Build Tools v28.0.3
21- Android Support Repository
22
23Getting Started
24---------------
25
26This sample uses the Gradle build system. To build this project, use the
27"gradlew build" command or use "Import Project" in Android Studio.
28
29Support
30-------
31
32- Google+ Community: https://plus.google.com/communities/105153134372062985968
33- Stack Overflow: http://stackoverflow.com/questions/tagged/android
34
35If you've found an error in this sample, please file an issue:
36https://github.com/googlesamples/android-DrawableTinting
37
38Patches are encouraged, and may be submitted by forking this project and
39submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
40
41License
42-------
43
44Copyright 2019 The Android Open Source Project, Inc.
45
46Licensed to the Apache Software Foundation (ASF) under one or more contributor
47license agreements.  See the NOTICE file distributed with this work for
48additional information regarding copyright ownership.  The ASF licenses this
49file to you under the Apache License, Version 2.0 (the "License"); you may not
50use this file except in compliance with the License.  You may obtain a copy of
51the License at
52
53http://www.apache.org/licenses/LICENSE-2.0
54
55Unless required by applicable law or agreed to in writing, software
56distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
57WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
58License for the specific language governing permissions and limitations under
59the License.
60