Implement CardView On Android Application – Android Studio Tutorials

In this video you’ll be seeing how to create an android application with CardView so I’ll be creating a new android studio project. You could implement this on an existing application by creating a new activity or just follow the steps that I show up in this video so let me things creating the project Now you have to copy this code. I’ll, be providing on the description now copy this and go to Gradle and add this to the Gradle File. Now build the Gradle. Now go to app ->res ->layout activity_main.xml file. Now remove the Layout type and I’ll be using Linear Layout now remove the text view now you have to call card view Now add ImageView to the CardView Set width and height to 100dp Now I’ll be coping an image on drawable so go to the drawable and paste the image that you want to show on the card view okay now I have called the image on the card view and I’ll be adding text view to the card view Now you can see that the text view and cardview is not properly aligned. For this you have to create a linearlayout with orientation vertical after the card view. Now you have to remove the closing of the linearlayout and closes after text view now give it the orientation vertical Now you can see the text and the image is properly aligned. Now you can give the text little more style and make it look better Now you can call and the image and text view to the center of the cardview Yeah now our view part of the card view is finished now you have to create an onclicking listener for the card view for that I’m creating onclick for the cardview I am giving it the name onclickcard. You know to click alt + Enter and create onclickcard on the main activity Java File I will be creating a toast so that you could see a toast on clicking the card Not only toast properly implemented now, we can run this application on the emulator and see Now the application has opened on the emulator if you click the card, you can see at the toast i have given the message “this is a toast” so if you click on the card view the toast will be be appearing so I hope you understand how to create the card view so if you like the video click the like button and subscribe to our channel for more such videos

One Reply to “Implement CardView On Android Application – Android Studio Tutorials”

Leave a Reply

Your email address will not be published. Required fields are marked *