Shared Element Transition + Content Transition - android

I am trying to achieve something real similar to the gif that can be seen in the following link:
Shared Element Transitions Between Views (not Activities or Fragments)
The only difference between that the transition needs to take place when there is an click event on a recyclerview item which is within an fragment (The fragment resides within an activity). The onClick then propogates to an activity which in turn hosts the actual fragment consisting of the details.
How can we go about achieving such animation?
For reference this is what my details xml looks like:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dip">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/holo_green_dark"
android:layout_margin="10dip"
android:id="#+id/detailsCardTitleNameTextView"
/>
<include layout="#layout/divider_details"/>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/black"
android:text = "#string/director_name"
android:layout_margin="10dip"
android:id="#+id/detailsCardDirectorTextView"
/>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/black"
android:layout_margin="10dip"
android:text="#string/released_date"
android:id="#+id/detailsCardReleasedTextView"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/card_view5"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dip">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/holo_green_dark"
android:layout_margin="10dip"
android:text="#string/writers_title"
android:id="#+id/detailsCardWriterTitleTextView"
/>
<include layout="#layout/divider_details"/>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/black"
android:layout_margin="10dip"
android:id="#+id/detailsCardWritersTextView"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/card_view2"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dip">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/holo_green_dark"
android:text="#string/plot_title"
android:layout_margin="10dip"
android:id="#+id/detailsCardPlotTitleTextView"
/>
<include layout="#layout/divider_details"/>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/black"
android:layout_margin="10dip"
android:id="#+id/detailsCardPlotTextView"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/card_view3"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dip">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/holo_green_dark"
android:layout_margin="10dip"
android:text="#string/imdb_rating"
android:id="#+id/imdbRatingTitleTextView"
/>
<include layout="#layout/divider_details"/>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/black"
android:layout_margin="10dip"
android:id="#+id/imdbRatingTextView"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
Any ideas, tips much appreciated.
Thanks!

Related

How to fix the toolbar to the top in activity with the 'adjustpan' option?

I made the Layout as follows.
<?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"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_below="#+id/layout_progress"
android:layout_alignParentStart="true"
android:layout_weight="1">
</android.support.v7.widget.Toolbar>
<ScrollView
android:id="#+id/scroll_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/linearLayout12"
android:layout_alignParentBottom="true"
android:layout_marginTop="?attr/actionBarSize"
android:layout_weight="0"
android:fillViewport="true">
<android.support.v7.widget.RecyclerView
android:id="#+id/message_table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</android.support.v7.widget.RecyclerView>
</ScrollView>
<LinearLayout
android:id="#+id/linearLayout12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_above="#+id/linearLayout8"
android:layout_alignParentLeft="true">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/linearLayout8"
android:layout_above="#+id/layout_inputfield"
android:layout_alignParentLeft="true">
</LinearLayout>
<LinearLayout
android:id="#+id/layout_inputfield"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/linearLayout6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center_vertical"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:src="#drawable/test" />
<ImageView
android:id="#+id/imageView18"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="#drawable/test2" />
<ImageView
android:id="#+id/imageView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:src="#drawable/test3" />
</LinearLayout>
<EditText
android:id="#+id/edit_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_weight="1"
android:background="#android:color/transparent"
android:ems="10"
android:inputType="textMultiLine"
android:textColor="#android:color/black">
<requestFocus />
</EditText>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
The problem is that the UI is cut when the keyboard is uploaded.
So I solved it with the [adjustpan] option.
This is the same result as I intended.
But I can't even see the "toolbar."
I always want to show "toolbar" at the top.
1
2
I'll attach the image to the current situation more easily.
If you need any information, please let me know.

Bottomsheet Error : The view is not a child of CoordinatorLayout

I want to create a layout in which 80% of the Screen Contains separate layout and 20% contains the bottom sheet vertically. But when i try to do it, it gives me error "The view is not a child of CoordinatorLayout". I got the error, but i can't figure out some other way to do it. Can Someone please help me to achieve it. Help will be Appreciated.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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"
android:background="#efefef">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="5">
<include
layout="#layout/content_main_new"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4" />
<include
layout="#layout/content_bottom_sheet2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
content_bottom_sheet2.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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 xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/bottomSheetLayout"
android:layout_width="match_parent"
android:layout_height="230dp"
android:background="#color/colorPrimary"
android:orientation="vertical"
android:padding="#dimen/activity_vertical_margin"
app:behavior_peekHeight="90dp"
app:layout_behavior="#string/bottom_sheet_behavior">
<!--android:background="#android:color/holo_orange_light"-->
<android.support.v7.widget.CardView
android:id="#+id/cvBottomCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="#dimen/spIconsize"
android:visibility="visible"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="10dp"
app:cardElevation="5dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:paddingTop="10dp"
android:orientation="horizontal">
<Button
android:layout_marginBottom="5dp"
android:id="#+id/btnReview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:layout_weight="1"
android:background="#drawable/rounded_button_darkgreen_bg"
android:text="Review"
android:textColor="#color/white" />
<Button
android:layout_marginBottom="5dp"
android:id="#+id/btnReschedule"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_weight="1"
android:background="#drawable/rounded_button_grey"
android:text="Reschedule"
android:textColor="#color/white" />
</LinearLayout>
<RelativeLayout
android:id="#+id/relLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/linearLayout"
android:layout_marginTop="5dp"
android:padding="10dp"
android:visibility="visible">
<ImageButton
android:id="#+id/imageButton"
android:layout_width="80dp"
android:layout_height="90dp"
android:src="#drawable/user"
android:visibility="gone" />
<TextView
android:id="#+id/tvappointmentId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toEndOf="#+id/imageButton"
android:text="Appointment ID - 5727"
android:textColor="#color/black" />
<TextView
android:id="#+id/tvCustomerName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tvappointmentId"
android:layout_toEndOf="#+id/imageButton"
android:text="Name - Virat Sharma"
android:textColor="#color/black" />
<TextView
android:id="#+id/tvLoanType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tvCustomerName"
android:layout_toEndOf="#+id/imageButton"
android:text="Loan Type - Home LOAN" />
<TextView
android:id="#+id/tvLoanAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tvLoanType"
android:layout_toEndOf="#+id/imageButton"
android:text="Loan Amount - 5727" />
<TextView
android:id="#+id/tvTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/tvappointmentId"
android:layout_alignBottom="#+id/tvappointmentId"
android:layout_alignParentEnd="true"
android:gravity="right"
android:text="01:22 Mins"
android:textColor="#color/red_error"
android:textStyle="bold"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
Can you try this way, please?
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/bottomSheetLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:behavior_peekHeight="90dp"
app:layout_behavior="#string/bottom_sheet_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="230dp"
android:background="#color/colorPrimary"
android:orientation="vertical"
android:padding="#dimen/activity_vertical_margin">
...
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
All that I have done is to put the id that you will call later as your bottom sheet in the root element (Which by the way could be a ConstraintLayout if you want), as you can notice, the parent of this root element will be automatically a CoodinatorLayout.
The second thing is to put this element with a height wrap_content
The layout behaviour should be in the root element, too. app:layout_behavior="#string/bottom_sheet_behavior"

Transparent Background For RecyclerView

this is my layout for a chat window in within my recyclerview:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#android:color/transparent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:background="#android:color/transparent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="10dp" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_weight="418"
android:layout_width="0dp"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="100"
android:gravity="right"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_profilepic_recview_chats"
android:background="#drawable/ripple"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="323"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="100"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="0dp"
android:layout_weight="323"
android:orientation="vertical"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:src="#drawable/chat_img_bubbletop"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#afebff">
<TextView
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textColor="#000000"
android:textSize="17sp"
android:id="#+id/txt_chatmessage_recview_chats"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:src="#drawable/chat_img_bubbletop"
android:rotation="180"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="100"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="0dp"
android:layout_weight="323"
android:layout_height="match_parent">
<TextView
android:text="12.02.2012"
android:id="#+id/txt_date_recview_chats"
android:textSize="12sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_weight="216"
android:layout_width="0dp"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="10dp" />
</LinearLayout>
</android.support.v7.widget.CardView>
The Background of the recyclerview is a simple image, that is supposed to show through the linear layouts. But unfortunately, this is the result:
So, as you can see, the background is displayed just right but the supposed to be transparent layout for the cardview i am using here is some wired black.
I can make it whatever color I want, but with:
android:background="#android:color/transparent"
it just gets black.
Can anyone help me here?
Thanks you! :)
You can use
app:cardBackgroundColor="#android:color/transparent"
You have to change your CardView background color. you can use
app:cardBackgroundColor="#android:color/transparent"
Instead of
android:background="#android:color/transparent"
Like :
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardBackgroundColor="#android:color/transparent">
<!-- Your view design -->
</android.support.v7.widget.CardView>
... turns out CARDVIEWS do not have such attribute. Making the rootlayout a linearlayout solved this issue.

How do I get an imageView and textview to both fill the layout when setting bitmap programmatically?

What I want is for qrcodetext to fit and display all the text in qrcode_layout and have qrimageView to fill the rest of qrcode_layout? But my layout below has the entire qrimageView cover qrcode_layout. I tried a bunch of other variations but without success.
Here is what it looks like.
Here is what I want it to look like.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:id="#+id/qrcodelayout">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/qrimageView"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/qrcodetext"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</RelativeLayout>
Use following code. Align your textview to bottom and then align your Qrcode Image above text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/qrcodetext"
android:gravity="center"
android:layout_alignParentBottom="true"
android:layout_marginTop="4dp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/qrimageView"
android:layout_gravity="center_horizontal"
android:layout_above="#id/qrcodetext"
android:layout_alignParentTop="true"
android:layout_marginTop="8dp" />
</RelativeLayout>
I think what i have understand you want is below: Plz check and tell me:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:id="#+id/qrcodelayout">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/qrcodetext"
android:gravity="center"
android:layout_weight="1"
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp" />
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_weight="1">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/qrimageView"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp" />
</LinearLayout>
</LinearLayout>
<!--<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>-->
</RelativeLayout>

No Touch feedback on recyclerview when using ripple effect library

Here is my main xml file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="#+id/tool_bar"
layout="#layout/tool_bar"></include>
<android.support.v4.widget.DrawerLayout
android:layout_below="#+id/tool_bar"
android:id="#+id/DrawerLayout"
android:elevation="7sp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tool_bar"
android:text="#string/hello_world" />
<android.support.v7.widget.RecyclerView
android:id="#+id/RecycleView"
android:layout_width="288dp"
android:background="#ffffff"
android:layout_height="match_parent"
android:layout_gravity="left"
android:scrollbars="vertical"
android:focusable="true"
android:clickable="true">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
Here is my item_row.xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/rowIcon"
android:paddingLeft="16dp"
android:src="#drawable/ic_launcher"/>
<com.balysv.materialripple.MaterialRippleLayout
android:id="#+id/ripple"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:paddingTop="4dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="#+id/rowText" />
</com.balysv.materialripple.MaterialRippleLayout>
</LinearLayout>
I am using the libray https://github.com/balysv/material-ripple
When I am not using the library the click is working fine but when using the library I did not receive any touch feedback.
Please help me on this.
Try to wrap your item_row.xml with the MaterialRippleLayout. Basically set it as your parent layout to receive the click from the user. Try this:
<?xml version="1.0" encoding="utf-8"?>
<com.balysv.materialripple.MaterialRippleLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/ripple"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:background="#ffffff"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:mrl_rippleColor="#80000000"
app:mrl_rippleOverlay="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/rowIcon"
android:paddingLeft="16dp"
android:src="#drawable/ic_launcher"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:paddingTop="4dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="#+id/rowText" />
</LinearLayout>
</com.balysv.materialripple.MaterialRippleLayout>

Categories

Resources