Advertisement
armadiazrino

test_activity

Feb 5th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 4.16 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.    android:layout_width="match_parent"
  4.    android:layout_height="match_parent"
  5.    android:orientation="vertical">
  6.  
  7.     <!--By default the LinearLayout is using orientation : vertical, so all of the
  8.    View will be created in vertical order-->
  9.  
  10.     <!--Study the View attributes and their features, Every attributes are unique.
  11.    Try to experiment on your own!-->
  12.  
  13.     <TextView
  14.        android:layout_width="match_parent"
  15.        android:layout_height="wrap_content"
  16.        android:text="Hello World"
  17.        android:textColor="#ff0000"
  18.        android:textSize="32sp"
  19.        android:textStyle="italic" />
  20.  
  21.     <Button
  22.        android:layout_width="match_parent"
  23.        android:layout_height="wrap_content"
  24.        android:drawableLeft="@mipmap/ic_person"
  25.        android:text="click here !"
  26.        android:textSize="32sp" />
  27.  
  28.     <!--LinearLayout below is using orientation : horizontal, wrapping 2 EditText.
  29.    By creating another LinearLayout with different orientation, the order of the View
  30.    inside of this LinearLayout will change from vertical to horizontal-->
  31.     <LinearLayout
  32.        android:layout_width="match_parent"
  33.        android:layout_height="wrap_content"
  34.        android:orientation="horizontal">
  35.  
  36.         <!--We are using weight : 1 on each View to divide the weight of the View to 1:1
  37.        related to the maximum width of the screen-->
  38.         <EditText
  39.            android:layout_width="match_parent"
  40.            android:layout_height="wrap_content"
  41.            android:layout_weight="1"
  42.            android:hint="Input Alphabet Here"
  43.            android:inputType="textCapWords" />
  44.  
  45.         <EditText
  46.            android:layout_width="match_parent"
  47.            android:layout_height="wrap_content"
  48.            android:layout_weight="1"
  49.            android:hint="Input Number Here"
  50.            android:inputType="number" />
  51.  
  52.     </LinearLayout>
  53.  
  54.     <LinearLayout
  55.        android:layout_width="match_parent"
  56.        android:layout_height="wrap_content"
  57.        android:orientation="horizontal">
  58.  
  59.         <CheckBox
  60.            android:layout_width="wrap_content"
  61.            android:layout_height="wrap_content"
  62.            android:checked="true"
  63.            android:text="Menggambar" />
  64.  
  65.         <CheckBox
  66.            android:layout_width="wrap_content"
  67.            android:layout_height="wrap_content"
  68.            android:text="Menulis" />
  69.  
  70.    
  71.     </LinearLayout>
  72.  
  73.     <!--RadioGroup is acting like a parent for RadioButton because users can only choose 1
  74.    options on RadioButton, without RadioGroup the RadioButton can be chosen more than 1-->
  75.     <RadioGroup
  76.        android:layout_width="match_parent"
  77.        android:layout_height="wrap_content"
  78.        android:orientation="horizontal">
  79.  
  80.         <RadioButton
  81.            android:layout_width="match_parent"
  82.            android:layout_height="wrap_content"
  83.            android:layout_weight="1"
  84.            android:checked="true"
  85.            android:text="Android" />
  86.  
  87.         <RadioButton
  88.            android:layout_width="match_parent"
  89.            android:layout_height="wrap_content"
  90.            android:layout_weight="1"
  91.            android:text="iOS"
  92.            android:textColor="@color/merah" />
  93.     </RadioGroup>
  94.  
  95.     <!--If you have an error in the entries attribute, it's probably you haven't create
  96.    a new string-array in Res > values > strings.xml
  97.    Ask your mentor on how to create it!-->
  98.     <Spinner
  99.        android:layout_width="match_parent"
  100.        android:layout_height="wrap_content"
  101.        android:entries="@array/spinner">
  102.  
  103.     </Spinner>
  104.  
  105.     <!--If you have an error in the android:src don't panic! it's because you don't
  106.    have the image as i do :D. You can use your own image or you can use same image,
  107.    download it here : https://drive.google.com/open?id=1IrCxRpOVI34vJwTTcL2gJ-i8zpGwJMQm-->
  108.     <ImageView
  109.        android:layout_width="match_parent"
  110.        android:layout_height="match_parent"
  111.        android:scaleType="centerCrop"
  112.        android:src="@drawable/androidparty" />
  113.  
  114. </LinearLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement