Created
August 1, 2017 22:55
-
-
Save artzmb/0e50731ad0d521ec1ca3f1e368cb2070 to your computer and use it in GitHub Desktop.
Android - Selector in vector drawables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context="ru.artzmb.solar.MainActivity"> | |
<ImageView | |
android:layout_width="100dp" | |
android:layout_height="100dp" | |
android:layout_centerInParent="true" | |
android:clickable="true" | |
app:srcCompat="@drawable/solar" | |
tools:ignore="ContentDescription" | |
/> | |
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:color="@color/red_800" android:state_selected="true" /> | |
<item android:color="@color/red_800" android:state_pressed="true" /> | |
<item android:color="@color/red" /> | |
</selector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
android:width="100dp" | |
android:height="100dp" | |
android:viewportWidth="100" | |
android:viewportHeight="100" | |
android:tint="@color/solar"> | |
<path | |
android:fillColor="#ffffff" | |
android:pathData="M35.48 0L50 14.52 64.52 0v32.26L50 46.77 35.48 32.26zM100 35.48L85.48 50 100 64.52H67.74L53.23 50l14.51-14.52zM64.52 100L50 85.48 35.48 100V67.74L50 53.23l14.52 14.51zM0 64.52L14.52 50 0 35.48h32.26L46.77 50 32.26 64.52z"/> | |
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="red">#f44336</color> | |
<color name="red_800">#c62828</color> | |
</resources> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment