Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Miwok app: Category screen with pressed states
<?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>
@saugatrai33

This comment has been minimized.

Copy link

@saugatrai33 saugatrai33 commented Nov 4, 2016

I have defined ripple effect in style.xml and it is not working. How to I get rid of it??

@saugatrai33

This comment has been minimized.

Copy link

@saugatrai33 saugatrai33 commented Nov 4, 2016

I have defined ripple effect in style.xml and it is not working. How to I get rid of it??

@saugatrai33

This comment has been minimized.

Copy link

@saugatrai33 saugatrai33 commented Nov 4, 2016

I have defined ripple effect in style.xml and it is not working. How to I get rid of it??

@tomarv

This comment has been minimized.

Copy link

@tomarv tomarv commented Feb 13, 2017

it is the same issue for me, no working

@engspa12

This comment has been minimized.

Copy link

@engspa12 engspa12 commented Feb 16, 2017

It works fine for me, could you print your code here, so we can see what it looks like?

Regards,

@Sam12111

This comment has been minimized.

Copy link

@Sam12111 Sam12111 commented May 22, 2017

showing error

@cabudies

This comment has been minimized.

Copy link

@cabudies cabudies commented Jun 3, 2017

@saugatrai33
Well you don't need to add it to style.xml. Just copy and paste it to your already defined activity_main.xml. It will work.

@sivasan1000

This comment has been minimized.

Copy link

@sivasan1000 sivasan1000 commented Jun 13, 2017

Work fine for me.

@badrddinb

This comment has been minimized.

Copy link

@badrddinb badrddinb commented Mar 19, 2018

Thanks

@SarahSamyMohamed

This comment has been minimized.

Copy link

@SarahSamyMohamed SarahSamyMohamed commented Mar 23, 2018

all words disappeared!!

@sherifhisham

This comment has been minimized.

Copy link

@sherifhisham sherifhisham commented Mar 27, 2018

beautiful details

@khudary

This comment has been minimized.

Copy link

@khudary khudary commented May 19, 2018

Hi @saugatrai33, ripple.xml must be created in the @drawable folder.
Here is an example with background style. Enjoy it

ripple.xml

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@android:color/black" >
    <item android:drawable="@drawable/background">
    </item>
</ripple>

background.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <solid android:color="@android:color/darker_gray" />
</shape>
@asmaadahab

This comment has been minimized.

Copy link

@asmaadahab asmaadahab commented Jul 5, 2018

thanks

@carlton-noronha

This comment has been minimized.

Copy link

@carlton-noronha carlton-noronha commented Jan 7, 2020

all words disappeared!!

Go to styles.xml and in the Style Tag named "CategoryStyle" use:
<item name="android:layout_height">wrap_content</item>
in place of:
<item name="android:layout_height">0dp</item>

@mohameddavexx

This comment has been minimized.

Copy link

@mohameddavexx mohameddavexx commented Mar 25, 2021

March 2021 Still looks great, thank you.

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