android-cardview

RecyclerView: how to catch the onClick on an ImageView?

ぃ、小莉子 提交于 2019-11-29 14:25:16
I have an ImageView in CardViews of my RecyclerView. I would like to catch the onClick on the ImageView, like I already did with the ListView. So, in the public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) I tried with: myViewHolder.imageView.setClickable(true); myViewHolder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.d("TEST", "Clicked"); } but this was totally ignored. The following code is working: myViewHolder.imageView.setImageResource(R.drawable.star_yellow); What can I do? Here's what I do in my

CardView shadow not appearing in Lollipop after obfuscate with proguard

ε祈祈猫儿з 提交于 2019-11-29 14:24:31
My CardView's shadows have disappeared on Lollipop devices after applying Proguard. I haven't defined any rule to protect this library, because I haven't read it was necessary at all. I attach you a couple of screenshots, first without running proguard, and secon after running it. Screenshot without proguard Screenshot with proguard And this is my xml <LinearLayout 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 listview inside cardview onTouch listener conflict / sensitivity

若如初见. 提交于 2019-11-29 07:10:19
Here's a test project which shows the issue dropbox link: https://www.dropbox.com/sh/8s3v9ydcj6jvpl8/AACZ2VRP2N9R1ec7pxrsAn0ga?dl=0 This is a continuation of the question I had here which was answered but now I am asking about the sensitivity/conflict of onTouch: Android CardView with ListView inside - onTouchListener on CardView not working I have a cardview with a listview inside. I will need the scroll and click item in list view to work too and I want to be able to move the entire cardview using the ontouchlistener too. I have set a onTouchListener on the cardview but it doesn't work

Error when adding CardView to layout

£可爱£侵袭症+ 提交于 2019-11-29 05:57:55
I wanted to try out the new toys that google gave us and I've run into some trouble. Here is my build.gradle: apply plugin: 'com.android.application' android { compileSdkVersion 'android-L' buildToolsVersion "20.0.0" defaultConfig { applicationId "com.tod.android.lpreviewtest" minSdkVersion 'L' targetSdkVersion 'L' versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:cardview-v7:+' } Now my

Attach custom CardView style to theme

烂漫一生 提交于 2019-11-29 05:55:01
问题 In my app, I have two themes (light and dark), and I want all of my CardView s to change their background color depending on which theme is selected. What I don't want is: <android.support.v7.widget.CardView style="@style/CardView.MyBlue" android:layout_width="200dp" android:layout_height="100dp" android:layout_gravity="center_horizontal"> The above code is not dynamic. I need my two styles to automatically be applied depending on if a light or a dark theme is selected. What I have right now

Passing RecyclerView CardView Clicked Item Data To Activity

岁酱吖の 提交于 2019-11-29 04:20:18
I have a question about passing clicked cardview data to activity, and here the full story : I have an Activity called "Details", which contains 2 TextViews in it's layout, Title & Description . I have setup a fragment ( tab_1 ) which contain the recyclerview codes and the the items data, each item of those contain : title & description . What i want : When the user click the item, it will open the Details Activity, and change Details layout title, with clicked item title, and the same for description . I've manged to create the other activity as an example, and made intent to start it, plus

Exception : android.view.InflateException: Binary XML file line #2: Error inflating class android.support.v7.widget.CardView

。_饼干妹妹 提交于 2019-11-29 04:17:20
I am using CardView of support library in my android app. I tried 4-5 hours to resolve this but i could not get success. I have added CardView as a library in my project & v7 appcompat also <android.support.v7.widget.CardView 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" android:layout_margin="5dp" android:orientation="horizontal" app:cardCornerRadius="4dp" > But my app is crashing with below logs 10-31 18:41:39.577: E/AndroidRuntime(5666): FATAL EXCEPTION:

Can one use cardview for listview item and how

好久不见. 提交于 2019-11-29 03:59:43
I would like to implement CardView in my app so that all ListView items are CardView s. Is it as simple as encapsulating a ListView item XML in CardView ? ridsatrio Yes. Underneath CardView is just a simple FrameLayout that you could just inflate into a ListView (or RecyclerView ). Here's an example: <android.support.v7.widget.CardView android:id="@+id/ly_root" 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="wrap_content"

RecyclerView Adapter and ViewHolder update dynamically

谁都会走 提交于 2019-11-28 23:43:40
I am trying to make an app that will be loading news from the network and will be updating dynamically. I am using a RecyclerView and CardView to display the content. I use Jsoup to parse sites. I don't think that my code is needed because my question is more theoretical than practical. I want to understand the process of dynamic updating using notifyDataSetChanged() . In my main activity I get all the headers and add them to list. But I need to wait untill all the items are loaded to start displaying them. I would really appreciate if someone could post a sample code of what I'm trying to do

android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawableWithShadow

痞子三分冷 提交于 2019-11-28 23:35:40
问题 I tried to use CardView in my Application which worked pretty good within my xml Layout. Since I want to generate them in my code and not via xml I tried to set the radius with CardView.setRadius()-Method as suggested by Android Developers (https://developer.android.com/preview/material/ui-widgets.html#cardview). This does not work at all! I hope someone can help me, with my problem or got a nice workaround with xml layouts. This is my code: int height = (int) TypedValue.applyDimension