Created
June 22, 2021 11:25
-
-
Save extsalt/f5ec6dc8bc87423c2e36671b9c81009c to your computer and use it in GitHub Desktop.
Android Linear Layout Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"> | |
<EditText | |
android:id="@+id/num1" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="10dp" | |
android:padding="10dp" | |
android:text="Enter number 1" | |
android:textSize="20dp" /> | |
<EditText | |
android:id="@+id/num2" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="10dp" | |
android:padding="10dp" | |
android:text="Enter number 2" | |
android:textSize="20dp" /> | |
<TextView | |
android:id="@+id/result" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="10dp" | |
android:padding="10dp" | |
android:text="Result: " | |
android:textSize="20dp" /> | |
<Button | |
android:id="@+id/button" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="10dp" | |
android:background="@color/purple_200" | |
android:text="Add" | |
android:textColor="@color/white" | |
android:textSize="20dp" /> | |
<Button | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="10sp" | |
android:background="@color/teal_200" | |
android:padding="10sp" | |
android:text="Button 2" | |
android:textColor="@color/white" /> | |
</LinearLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment