Last active
March 18, 2019 08:54
-
-
Save adammb86/1a461937d972bdebaefbbbc41a349b65 to your computer and use it in GitHub Desktop.
Layout di RelativeLayout
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"?> | |
<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_margin="@dimen/activity_horizontal_margin" | |
tools:context=".MainActivity"> | |
<EditText | |
android:id="@+id/edt_username" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_margin="@dimen/activity_vertical_margin" | |
android:hint="@string/isikan_username" | |
android:textSize="16sp" /> | |
<EditText | |
android:id="@+id/edt_password" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_below="@id/edt_username" | |
android:layout_margin="@dimen/activity_vertical_margin" | |
android:hint="@string/isikan_password" | |
android:inputType="textPassword" | |
android:textSize="16sp" /> | |
<Button | |
android:id="@+id/btn_login" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_below="@id/edt_password" | |
android:layout_margin="@dimen/activity_vertical_margin" | |
android:text="LOGIN" | |
android:textAlignment="center" | |
android:textSize="20sp" /> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="LUPA KATA SANDI" | |
android:textColor="@color/biruCustom" | |
android:id="@+id/tv_lupa_sandi" | |
android:textSize="12sp" | |
android:textAlignment="center" | |
android:layout_below="@id/btn_login"/> | |
</RelativeLayout> |
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
package com.example.percobaanrelativelayout; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.Toast; | |
public class MainActivity extends AppCompatActivity implements View.OnClickListener { | |
Button btnLogin; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
btnLogin = findViewById(R.id.btn_login); | |
btnLogin.setOnClickListener(this); | |
} | |
@Override | |
public void onClick(View view) { | |
if(view.getId()==R.id.btn_login){ | |
Toast.makeText(this,"Anda berhasil Login!",Toast.LENGTH_LONG).show(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment