Tags down


How to change textview text on cardview click?

By : joosed
Date : October 17 2020, 06:10 AM
I think the issue was by ths following , You have to override the onBindViewHolder() method then implement as below.
code :
public void  onBindViewHolder(RecyclerViewHolder holder, int position) {
   Model model = getItem(position);

public class RecyclerViewHolder extends RecyclerView.ViewHolder {

  public final TextView title;
  public final TextView product;

  public RecyclerViewHolder(View itemView) {
    super (itemView);
    title    = itemView.findViewById(R.id.title);
    product  = itemView.findViewById(R.id.product);

  public void bind(final Model model){
    itemView.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {

Share : facebook icon twitter icon

Change a textview text and position when you click and then click again go back to the original

By : David Li
Date : March 29 2020, 07:55 AM
will help you Hello i am new in Android apps, so i want your help. , Try this..
code :
        Log.v("View.VISIBLE", ""+View.VISIBLE);      //0

        Log.v("View.GONE", ""+View.GONE);            //8

        Log.v("visible", ""+paragraphmore.getVisibility());

        if(paragraphmore.getVisibility() == 0){
            view.setText("Read Less");
            view.setText("

Expanding cardView with a TextView on click

By : Mian Sohail Rafiq
Date : March 29 2020, 07:55 AM
I wish this help you I do the same thing with following structure :
first of all create AnimationHelper class like following :
code :
public class AnimationHelper {
    public static void expand(final View v) {
        v.measure(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        final int targetHeight = v.getMeasuredHeight();

        v.getLayoutParams().height = 0;
        Animation a = new Animation() {
            protected void applyTransformation(float interpolatedTime, Transformation t) {
                v.getLayoutParams().height = interpolatedTime == 1
                        ? LinearLayout.LayoutParams.WRAP_CONTENT
                        : (int) (targetHeight * interpolatedTime);

            public boolean willChangeBounds() {
                return true;

        // 1dp/ms
        a.setDuration((int) (targetHeight / v.getContext().getResources().getDisplayMetrics().density));

    public static void collapse(final View v) {
        final int initialHeight = v.getMeasuredHeight();

        Animation a = new Animation() {
            protected void applyTransformation(float interpolatedTime, Transformation t) {
                if (interpolatedTime == 1) {
                } else {
                    v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime);

            public boolean willChangeBounds() {
                return true;
        // 1dp/ms
        a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density));
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"


                android:textColor="@color/color_primary_dark" />


    <include layout="@layout/view_popup_menu_expand" />


How to get text from TextView inside a CardView?

Date : March 29 2020, 07:55 AM
may help you . Inside a CardView I have a LinearLayout with three TextViews in it and I want to get the text from these TextViews. My XML-file looks like this: , So many options in here.
1. Give id for your TextViews
code :
for (int i = 0; i < defense.getChildCount(); i++){
        CardView card = defense.getChildAt(i);
        ViewGroup viewGroup = ((ViewGroup)card.getChildAt(0));
        for(int j=0;j<viewGroup.getChildCount();j++){
            String getName = ((TextView)viewGroup.getChildAt(j)).getText().toString();
            id[i] = getName;

Text appearance, inside TextView and CardView

By : PudDog
Date : March 29 2020, 07:55 AM
wish helps you Okay, I got the solution. You have to give the text a shadow effect, then the text appears clear and without the background color lamination.

Holder cardview change textview color error

By : user3525946
Date : March 29 2020, 07:55 AM
seems to work fine i want to change color of my textview inside of cardview when its value is "kritis" or "kurang" but somehow everytime when my textview in position 0 and its value is either kritis or kurang it always change color textiew in position 0 and also position 7, and also when its in position 1 it will set color text view in position 8 too and so... and then i try to use logd to see howmany times my setcolor initiate and its only 1x (when changing color only position 1 and 7) or 2x (when changing color text position 0,1,7,8)(my cardview is inside recyclerview) , try adding else to set default background color :
code :
if(holder.textViewSKSkat.getText().equals("kritis") || holder.textViewSKSkat.getText().equals("kurang")){
    Log.d("testing", "ayayaya");
} else {
    holder.textViewSKSkat.setTextColor(Color.rgb(0,0,0)); //TODO : SET DEFAULT COLOR

if(holder.textViewIPKkat.getText().equals("kritis") || holder.textViewIPKkat.getText().equals("kurang")){
    Log.d("testing", "ayayaya");
} else {
    holder.textViewIPKkat.setTextColor(Color.rgb(0,0,0)); //TODO : SET DEFAULT COLOR
Related Posts Related Posts :
  • Android CameraX doesn't show anything
  • XML constraint layout: Elements placed on top of each other, fix?
  • Flutter - dynamic height on a tab
  • With Scoped Storage introduced in Android Q, how am I supposed to develop a file manager app?
  • Can't resolve symbol android.support.v4.util.Pools in react-native-gesture-handler
  • Jetpack Compose: Could not set unknown property 'useIR'
  • SQLiteException: file is not a database while upgrading sqlcipher version from 3 to 4
  • What are best practices of implementing user login session in android application?
  • Button text not aligned center vertically in react native
  • "flutter (os error: no address associated with hostname, errno = 7)" only for android
  • How to catch platformException in flutter/dart?
  • Unable to connect to ADB
  • How can I test In-app updates in Android?
  • How to apply multiple generics in a function using Kotlin
  • Gradle DSL method not found: 'kapt()'
  • Android ADB: How to push multiple files, into an emulator?
  • How to run a multiple AND query with Android Room?
  • How do i fix the getting null location value from FusedLocationProviderClient in android
  • Which ad formats uses tinder?
  • How to perform delete api in retrofit
  • AWS AppSync Error - AWSMobileClientStore.get(String) on null object reference
  • How to make back button on WebView work in onBackPressed?
  • Circular reference error in firebase with R8
  • how can I move views on the right direction in constrainlayout
  • Send Intent From Activity To Fragment
  • findViewById with PhotoView library problem
  • Removing the bottom Padding from a TextView while using HTML Format
  • Defining resValue conditionally in build.gradle
  • Is there another solutions instead of nested Recyclerview
  • Firebase + Flutter - Cloud functions onCall result in "unauthenticated" error from Android app
  • App crash on opening document for some devices
  • How to fix Android compatibility warnings
  • Can't override android color resources
  • How add menu item's only for debug build type
  • RecyclerView with CardView Items, notifyItemChanged and shadow problem
  • Start activity without click on push notification's item
  • Checking if kapt uses incremental annotation processing
  • Show locations near user's location
  • How to hide a sub-mesh from SFB file in ArCore Android
  • There is always a default background on TextInputLayout in Android
  • 'List' is abstract; cannot be instantiated
  • A list in a list?
  • Wrong date returned from Location.getTime after 6 April 2019 (week number rollover)
  • socket connection using retrofit in Kotlin
  • Build Command Failed for CMake
  • Navigating between pages
  • Android : Support in-app updates result getting cancelled
  • What will cause Modifier 'abstract' not allowed here in RoomDatabase file using Android Studio?
  • Layout Expression - Ternary Operation for drawable value
  • How to have an Android Button with only a bottom border?
  • Actions on Google - Unable to test intent for app action on Android
  • Required single selection on MaterialButtonToggleGroup
  • AAPT: error: attribute android:forceDarkAllowed not found
  • Stop reloading previous fragment by using Navigation architecure
  • How to close the SimpleDialog in flutter after choosing an option
  • Sniffing SSL packets using Wireshark
  • Integrating google map api key in my android project
  • How to fix TextView position when text in it changes
  • Prevent 3rd party libraries to get my push notifications
  • Android bluetooth printer app works fine in debug mode but doesn't work in release mode
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk