activity_main.xml (Kalkulator sederhana)

<?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" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="com.unsada.calculator.MainActivity" tools:showIn="@layout/activity_main"> android:layout_width="369dp" android:layout_height="497dp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintHorizontal_bias="0.533"> <TextView android:id="@+id/Tittle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Calculator Irsyad" android:textColor="@color/colorPrimaryDark" android:textSize="24sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.032" android:layout_above="@+id/textView2" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginLeft="109dp" android:layout_marginStart="109dp" android:layout_marginBottom="19dp" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="First Value" android:textSize="18sp" tools:layout_editor_absoluteX="28dp" tools:layout_editor_absoluteY="69dp" android:layout_above="@+id/etfirstvalue" android:layout_alignLeft="@+id/etfirstvalue" android:layout_alignStart="@+id/etfirstvalue" /> <EditText android:id="@+id/etfirstvalue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="12dp" android:ems="10" android:inputType="number" tools:layout_editor_absoluteX="28dp" tools:layout_editor_absoluteY="91dp" android:layout_above="@+id/textView3" android:layout_centerHorizontal="true" /> <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Second Value" android:textSize="18sp" tools:layout_editor_absoluteX="28dp" tools:layout_editor_absoluteY="147dp" android:layout_above="@+id/etsecondvalue" android:layout_alignLeft="@+id/etfirstvalue" android:layout_alignStart="@+id/etfirstvalue" /> <EditText android:id="@+id/etsecondvalue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10" android:inputType="number" tools:layout_editor_absoluteX="28dp" tools:layout_editor_absoluteY="169dp" android:layout_above="@+id/tambah" android:layout_alignLeft="@+id/textView3" android:layout_alignStart="@+id/textView3" /> <Button android:id="@+id/tambah" android:layout_width="88dp" android:layout_height="60dp" android:text="+" tools:layout_editor_absoluteX="35dp" tools:layout_editor_absoluteY="237dp" android:layout_alignParentBottom="true" android:layout_alignLeft="@+id/etsecondvalue" android:layout_alignStart="@+id/etsecondvalue" android:layout_marginBottom="204dp" /> <Button android:id="@+id/kurang" android:layout_width="88dp" android:layout_height="60dp" android:text="-" tools:layout_editor_absoluteX="106dp" tools:layout_editor_absoluteY="237dp" android:layout_alignBaseline="@+id/kali" android:layout_alignBottom="@+id/kali" android:layout_alignLeft="@+id/tambah" android:layout_alignStart="@+id/tambah" /> <Button android:id="@+id/bagi" android:layout_width="88dp" android:layout_height="60dp" android:text="/" tools:layout_editor_absoluteX="173dp" tools:layout_editor_absoluteY="237dp" android:layout_alignBaseline="@+id/tambah" android:layout_alignBottom="@+id/tambah" android:layout_alignRight="@+id/etsecondvalue" android:layout_alignEnd="@+id/etsecondvalue" /> <Button android:id="@+id/kali" android:layout_width="88dp" android:layout_height="60dp" android:text="x" tools:layout_editor_absoluteX="243dp" tools:layout_editor_absoluteY="237dp" android:layout_below="@+id/bagi" android:layout_alignLeft="@+id/bagi" android:layout_alignStart="@+id/bagi" android:layout_marginTop="17dp" /> <TextView android:id="@+id/hasil" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/kurang" android:layout_alignStart="@+id/kurang" android:layout_below="@+id/kurang" android:layout_marginLeft="11dp" android:layout_marginStart="11dp" android:layout_marginTop="39dp" android:textColor="#0000CD" android:textSize="24sp" tools:layout_editor_absoluteX="28dp" tools:layout_editor_absoluteY="351dp" /> </RelativeLayout>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.