Created
May 13, 2016 19:14
-
-
Save udacityandroid/e11b81e3bdcff1c073c6e24a4fdb3365 to your computer and use it in GitHub Desktop.
Miwok app: Category screen with pressed states
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"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@color/tan_background" | |
android:orientation="vertical" | |
tools:context="com.example.android.miwok.MainActivity"> | |
<!-- Numbers category --> | |
<FrameLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="@color/category_numbers"> | |
<TextView | |
android:id="@+id/numbers" | |
style="@style/CategoryStyle" | |
android:background="?android:attr/selectableItemBackground" | |
android:text="@string/category_numbers" /> | |
</FrameLayout> | |
<!-- Family category --> | |
<FrameLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="@color/category_family"> | |
<TextView | |
android:id="@+id/family" | |
style="@style/CategoryStyle" | |
android:background="?android:attr/selectableItemBackground" | |
android:text="@string/category_family" /> | |
</FrameLayout> | |
<!-- Colors category --> | |
<FrameLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="@color/category_colors"> | |
<TextView | |
android:id="@+id/colors" | |
style="@style/CategoryStyle" | |
android:background="?android:attr/selectableItemBackground" | |
android:text="@string/category_colors" /> | |
</FrameLayout> | |
<!-- Phrases category --> | |
<FrameLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="@color/category_phrases"> | |
<TextView | |
android:id="@+id/phrases" | |
style="@style/CategoryStyle" | |
android:background="?android:attr/selectableItemBackground" | |
android:text="@string/category_phrases" /> | |
</FrameLayout> | |
</LinearLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From API Level 22 onwards just add this property to xml layout : android:foreground="?attr/selectableItemBackground" and it will work smoothly add the background color accordingly.