简体   繁体   中英

Android CardView implementation

I created an Android app with list view. Whenever the an element is clicked, it passes intent to cardview.I have a single cardview in my layout file, and use it for every element in the listView.

For each list item, I define different implementation for the CardView in Java passing intents from one java file to the other. .

Please is this a good practice using a single card view and Recycler View for multiple elements changing their text programmatically. I haven't seen anyone do something like that.

Edit @Ankit something like...

Something like

>
<android.support.v7.widget.RecyclerView/>
</LinearLayout>```



**Tutorial page 1**
       ```public class Lesson_Galaxy_One extends AppCompatActivity
{ super.onCreate(savedInstanceState);
        setContentView(R.layout.lesson_galaxy);

}```


**Tutorial 2**
       ```public class Lesson_Galaxy_Two extends AppCompatActivity
{ super.onCreate(savedInstanceState);
        setContentView(R.layout.lesson_galaxy);

}```

**Tutorial 3**
       ```public class Lesson_Galaxy_Three extends AppCompatActivity
{ super.onCreate(savedInstanceState);
        setContentView(R.layout.lesson_galaxy);

}```


Each with different elements for the RecyclerView's CardView with intents being passed from one to the other.

There won't be any issues of using a single card view for multiple list items.It's totally fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM