Thursday, December 5, 2019

Android Layout menu_utama.xml CardView

Tags


Membuat Tampilan Menu dengan Card View dengan Budah


menu_utama.xml
<?xml version="1.0" encoding="utf-8"?>

<ScrollView
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="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg"
tools:context=".Menu_utama">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="10"
android:gravity="center"
android:padding="10dp">
<TextView
android:id="@+id/txtMarquee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#000000"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:text="Tes Belajar Maps GPS dan Mydirecton by Heru"
android:textColor="#ffffff"
android:textSize="18sp"
android:typeface="sans" />

<LinearLayout
android:clipToPadding="false"
android:gravity="center"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.v7.widget.CardView
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_margin="10dp"
app:cardElevation="20dp"
app:cardCornerRadius="20dp"
android:id="@+id/btnPengetahuan">


<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:src="@drawable/admin"
android:layout_gravity="center_horizontal"
android:layout_width="90dp"
android:layout_height="90dp" />

<TextView
android:text="Pengetahuan"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />



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

<android.support.v7.widget.CardView
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_margin="10dp"
app:cardElevation="20dp"
app:cardCornerRadius="20dp"
android:id="@+id/btnBahan">


<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:src="@drawable/admin"
android:layout_gravity="center_horizontal"
android:layout_width="90dp"
android:layout_height="90dp" />

<TextView
android:text="Alat dan Bahan"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />



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

</LinearLayout>

<LinearLayout
android:clipToPadding="false"
android:gravity="center"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.v7.widget.CardView
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_margin="10dp"
app:cardElevation="20dp"
app:cardCornerRadius="20dp"
android:id="@+id/btnCara">


<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:src="@drawable/admin"
android:layout_gravity="center_horizontal"
android:layout_width="90dp"
android:layout_height="90dp" />

<TextView
android:text="Cara Mengukur"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />



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

<android.support.v7.widget.CardView
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_margin="10dp"
app:cardElevation="20dp"
app:cardCornerRadius="20dp"
android:id="@+id/btnPola">


<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:src="@drawable/admin"
android:layout_gravity="center_horizontal"
android:layout_width="90dp"
android:layout_height="90dp" />

<TextView
android:text="Macam Pola"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />



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

</LinearLayout>

<LinearLayout
android:clipToPadding="false"
android:gravity="center"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.v7.widget.CardView
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_margin="10dp"
app:cardElevation="20dp"
app:cardCornerRadius="20dp"
android:id="@+id/btnUji">


<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:src="@drawable/admin"
android:layout_gravity="center_horizontal"
android:layout_width="90dp"
android:layout_height="90dp" />

<TextView
android:text="Uji Pengetahuan"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />



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

</LinearLayout>

</LinearLayout>
</ScrollView>

Gradle: 

implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'