NAMA : MUHAMMAD MUSLIM ABDUL JABBAAR
NIM : 217200035
PRODI : TEKNIK INFORMATIKA
MATKUL : MOBILE PROGRAMMING 1
PRAKTIKUM 2
a.
Buat project baru seperti biasa
b.
Pada activity_main.xml
c.
Anda lakukan perubahan
<?xml version=”1.0”
encoding=”utf-8”?>
<RelativeLayout 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:
layout_weight=”100”
android:
orientation=”vertical”
android:
padding=”10dp”
</RelativeLayout> àotomatis
d. RelativeLayout adalah tentang penggunaan widget
atau object yang ada pada tampilan, tata letaknya relative terhadap objek
didalamnya
Relative Layout
Source Code :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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">
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text 1"
android:height="100dp"
android:width="100dp"
android:gravity="center"
android:textStyle="bold"
android:textColor="@color/white"
android:background="@color/purple_500"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
/>
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text 2"
android:height="50dp"
android:width="50dp"
android:gravity="center"
android:textStyle="bold"
android:textColor="@color/white"
android:background="@color/purple_500"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:layout_above="@id/text1"
/>
</RelativeLayout>
FrameLayout
Source Code :
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:layout_weight="100"
android:orientation="vertical"
android:padding="10dp"
>
<ImageView
android:id="@+id/gbr1"
android:src="@mipmap/ic_launcher"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<ImageView
android:id="@+id/gbr2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/ic_launcher"
android:visibility="gone"
/>
</FrameLayout>
TableLayout
Source Code :
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="100"
android:orientation="vertical"
android:padding="10dp"
>
<TableRow>
<TextView
android:text="Username"
android:layout_column="1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
<EditText
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_column="2"
android:hint="Masukkan username"
/>
</TableRow>
<TableRow>
<TextView
android:text="Password"
android:layout_column="1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
<EditText
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_column="2"
android:hint="Masukkan password"
/>
</TableRow>
</TableLayout>
Komentar
Posting Komentar