Thursday, February 16, 2023

TUTORIAL MEMBUAT CARD VIEW

TUTORIAL BELAJAR MEMBUAT MENU MAKANAN MENGGUNAKAN CARD VIEW


Disini saya memberikan tutorial membuat menu makanan dengan card view dengan menggunakan android studio.

dan disini saya menyediakan codingan card view dan memberikan codingan scroll view 

contohnya seperti berikut :


<?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"

    tools:context=".MainActivity"

    android:background="@color/cardview_light_background">


    <ScrollView

        android:layout_width="match_parent"

        android:layout_height="600dp"

        android:layout_margin="10dp"

        app:layout_constraintTop_toTopOf="parent">


    <LinearLayout

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:orientation="vertical">


        <TextView

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:paddingTop="20dp"

            android:paddingBottom="35dp"

            android:textColor="#FFFFFF"

            android:text="jefri seprianto"

            android:background="#770DE1"

            android:textStyle="bold"

            android:textAlignment="center"

            android:textSize="25dp" />


<android.support.v7.widget.CardView

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    app:cardCornerRadius="10dp"

    app:cardElevation="20dp"

    android:layout_marginLeft="10dp"

    android:layout_marginRight="10dp"

    android:layout_marginBottom="30dp"

    android:layout_marginTop="30dp"

    >


    <ImageView

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:scaleType="center"

        android:src="@drawable/np" />


<!--    ==========================-->


    <LinearLayout

        android:layout_width="wrap_content"

        android:layout_height="match_parent"

        android:paddingTop="0dp"

        android:paddingLeft="150dp"

        android:orientation="vertical">


        <TextView

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:text="NASI PECEL"

            android:textSize="27dp"

            android:background="#ff0"

            />


        <TextView

            android:layout_width="239dp"

            android:layout_height="wrap_content"

            android:text="NASI PECEL adalah makanan khas yang berasal dari NASI PECEL yang sangat terkenal baik di nusantara maupun di dunia"

            android:textColor="#000"

            android:textSize="20dp" />

    </LinearLayout>


</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    app:cardCornerRadius="10dp"

    app:cardElevation="20dp"

    android:layout_marginLeft="10dp"

    android:layout_marginRight="10dp"

    android:layout_marginBottom="30dp"

    android:layout_marginTop="30dp"

    >


    <ImageView

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:scaleType="center"

        android:src="@drawable/nk" />


<!--    ==========================-->


    <LinearLayout

        android:layout_width="wrap_content"

        android:layout_height="match_parent"

        android:paddingTop="0dp"

        android:paddingLeft="150dp"

        android:orientation="vertical">


        <TextView

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:text="NASI KUNING"

            android:textSize="27dp"

            android:background="#ff0"

            />


        <TextView

            android:layout_width="239dp"

            android:layout_height="wrap_content"

            android:text="NASI KUNING adalah makanan khas yang berasal dari JAWA TIMUR yang sangat terkenal baik di nusantara maupun di dunia"

            android:textColor="#000"

            android:textSize="20dp" />

    </LinearLayout>


</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    app:cardCornerRadius="10dp"

    app:cardElevation="20dp"

    android:layout_marginLeft="10dp"

    android:layout_marginRight="10dp"

    android:layout_marginBottom="30dp"

    android:layout_marginTop="30dp"

    >


    <ImageView

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:scaleType="center"

        android:src="@drawable/ns" />


<!--    ==========================-->


    <LinearLayout

        android:layout_width="wrap_content"

        android:layout_height="match_parent"

        android:paddingTop="0dp"

        android:paddingLeft="150dp"

        android:orientation="vertical">


        <TextView

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:text="NASI UDUK"

            android:textSize="27dp"

            android:background="#ff0"

            />


        <TextView

            android:layout_width="239dp"

            android:layout_height="wrap_content"

            android:text="NASI UDUK adalah makanan khas yang berasal dari JAWA TIMUR yang sangat terkenal baik di nusantara maupun di dunia"

            android:textColor="#000"

            android:textSize="20dp" />

    </LinearLayout>


</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    app:cardCornerRadius="10dp"

    app:cardElevation="20dp"

    android:layout_marginLeft="10dp"

    android:layout_marginRight="10dp"

    android:layout_marginBottom="30dp"

    android:layout_marginTop="30dp"

    >


    <ImageView

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:scaleType="center"

        android:src="@drawable/r" />


<!--    ==========================-->


    <LinearLayout

        android:layout_width="wrap_content"

        android:layout_height="match_parent"

        android:paddingTop="0dp"

        android:paddingLeft="150dp"

        android:orientation="vertical">


        <TextView

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:text="RENDANG"

            android:textSize="27dp"

            android:background="#ff0"

            />


        <TextView

            android:layout_width="239dp"

            android:layout_height="wrap_content"

            android:text="RENDANG adalah makanan khas yang berasal dari sumatra barat yang sangat terkenal baik di nusantara maupun di dunia"

            android:textColor="#000"

            android:textSize="20dp" />

    </LinearLayout>


</android.support.v7.widget.CardView>


    </LinearLayout>

    </ScrollView>

</LinearLayout>


DAN HASILNYA SEPERTI BERIKUT



0 comments:

Post a Comment