- First, create a layout with the name about :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="500dp"
android:clickable="true"
android:duplicateParentState="true"
android:gravity="top"
android:longClickable="true"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="35dp"
android:gravity="center"
android:text="Isinya nanti"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#fff"
android:textSize="23sp"
android:textStyle="bold" />
<customfonts.MyTextView
android:gravity="center"
android:id="@+id/textView2aa"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="111310059"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#fff"
android:layout_alignBottom="@+id/textView2"
android:layout_marginBottom="31dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<TextView
android:gravity="center"
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="139dp"
android:text="Isinya"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#fff"
android:layout_below="@+id/textView1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<TextView
android:textStyle="bold"
android:gravity="center"
android:id="@+id/textViewdd2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Universitas Muhammadiyah jember"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#fff"
android:layout_below="@+id/textView2aa"
android:layout_marginTop="126dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
2. Second, create a command to call the layout :
public void about() {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(Berhasil.this);
LayoutInflater inflater = getLayoutInflater();
View alertDialogView = inflater.inflate(R.layout.about, null);
alertDialog.setView(alertDialogView);
alertDialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
alertDialog.show();
}
Replace the blue color with the name of your layout.
3. Lastly, call the command with your method name
0 Komentar
Silahkan Dikomentar ya?