Tuesday, October 5, 2021

CardView in Android

 àCard Design:-

Xml code:-

<?xml version="1.0" encoding="utf-8"?>
<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:orientation="vertical"
   
tools:context=".MainActivity">



   <
TextView
      
android:id="@+id/text1"
      
android:layout_width="wrap_content"
      
android:layout_height="wrap_content"
      
android:layout_gravity="center_horizontal"
      
android:text="CARD VIEW DESIGN"
      
android:textColor="#673AB7"
      
android:textStyle="bold"
      
android:layout_marginBottom="10dp"
      
android:textSize="30dp"/>
    <
ScrollView
       
android:layout_width="match_parent"
       
android:layout_weight="9"
       
android:layout_height="wrap_content">

            <
GridLayout
               
android:layout_width="match_parent"
               
android:layout_height="match_parent"
               
android:layout_below="@+id/text1"

               
android:columnCount="15"
               
android:rowCount="15">

                <
androidx.cardview.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
                   
android:layout_width="match_parent"
                   
android:layout_height="wrap_content"
                   
android:layout_row="0"
                   
android:layout_column="0"
                   
android:layout_margin="10dp"
                   
card_view:cardCornerRadius="8dp"
                   
card_view:cardElevation="8dp">

                    <
LinearLayout
                       
android:layout_width="match_parent"
                       
android:layout_height="match_parent"
                       
android:weightSum="2"
                       
android:orientation="horizontal" >

                        <
de.hdodenhof.circleimageview.CircleImageView
                           
xmlns:app="http://schemas.android.com/apk/res-auto"
                           
android:id="@+id/studentprofile_image"
                            
android:layout_width="110dp"
                           
android:layout_height="125dp"
                           
android:src="@drawable/schoollogo"
                           
app:civ_border_width="1dp"
                           
android:padding="0dp"
                           
app:civ_border_color="#FF000000"/>

                        <
LinearLayout
                           
android:layout_width="match_parent"
                           
android:layout_weight="2"
                            
android:orientation="vertical"
                           
android:layout_height="match_parent">
                            <
TextView
                               
android:layout_width="wrap_content"
                               
android:layout_height="wrap_content"
                               
android:text="HOME"
                               
android:textSize="22dp"
                               
android:layout_marginTop="10dp"
                               
android:layout_gravity="center_horizontal"
                               
android:layout_marginBottom="5dp"
                               
android:textColor="#000000"
                               
android:textStyle="bold" />

                            <
TextView
                                
android:layout_width="wrap_content"
                               
android:layout_height="wrap_content"
                               
android:text="Hello this is a  new address"
                               
android:textSize="22dp"
                                
android:paddingRight="5dp"
                               
android:layout_marginLeft="10dp"
                               
android:textStyle="bold" />
                        </
LinearLayout>




                    </
LinearLayout>
                </
androidx.cardview.widget.CardView>


            </
GridLayout>
    </
ScrollView>

</
LinearLayout>

No comments:

Post a Comment

Activity Navigation One Activity to another Activity

Main Activity :-   <? xml version ="1.0" encoding ="utf-8" ?> < RelativeLayout xmlns: android ="http://sch...