Membuat Aplikasi android Mengenal Minuman Tradisional Indonesia

Membuat aplikasi di Moblie dengan login, untuk Sayarat untuk memenuhi ujian akhir semester mata kuliah Moblie Programing,Berikut ini langkah untuk membuat aplikasi menu minuman tradisional.

Pertama-tama kita membuat login terlebih dahulu, berikut di bawah ini.

LoginActivity.java

package com.ilham;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class LoginActivity extends AppCompatActivity {
    EditText mTextUsername;
    EditText mTextPassword;
    Button mButtonLogin;
    TextView mTextViewREGISTER;
    DatabaseHelper db;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        db = new DatabaseHelper(this);
        mTextUsername = (EditText)findViewById(R.id.edittext_username);
        mTextPassword = (EditText)findViewById(R.id.edittext_password);
        mButtonLogin = (Button) findViewById(R.id.button_login);
        mTextViewREGISTER = (TextView) findViewById(R.id.textview_register);
        mTextViewREGISTER.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent registerIntent = new Intent(LoginActivity.this,RegisterActivity.class);
                startActivity(registerIntent);
            }
        });

        mButtonLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String user = mTextUsername.getText().toString().trim();
                String pwd = mTextPassword.getText().toString().trim();
                Boolean res = db.checkUser(user, pwd);
                if (res == true)
                {
                    Intent HomePage = new Intent(LoginActivity.this,MainActivity.class);
                    startActivity(HomePage);
                }
                else
                    Toast.makeText(LoginActivity.this, "Login Error", Toast.LENGTH_SHORT).show();
            }
        });
        }
    }

activity_login.xml

<?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:layout_gravity="center_horizontal"
    android:background="@drawable/aura"
    android:orientation="vertical"
    tools:context="com.ilham.LoginActivity">

    <EditText
        android:id="@+id/edittext_username"
        android:layout_width="200dp"
        android:layout_height="40dp"
        android:layout_gravity="center"
        android:layout_marginTop="250dp"
        android:background="#ffffffff"
        android:drawableLeft="@drawable/username"
        android:hint="@string/username" />

    <EditText
        android:id="@+id/edittext_password"
        android:layout_width="200dp"
        android:layout_height="40dp"
        android:layout_gravity="center"
        android:layout_marginTop="20dp"
        android:background="#ffffffff"
        android:drawableLeft="@drawable/password"
        android:hint="@string/password" />

    <Button
        android:id="@+id/button_login"
        android:layout_width="200dp"
        android:layout_height="50dp"
        android:layout_gravity="center"
        android:layout_marginTop="40dp"
        android:text="@string/login" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginTop="10dp"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="35dp"
            android:text="@string/not_registered"
            android:textColor="#ffffffff" />

        <TextView
            android:id="@+id/textview_register"
            android:layout_width="wrap_content"
            android:layout_height="35dp"
            android:paddingLeft="10dp"
            android:text="@string/register"
            android:textColor="#ffffffff"
            android:textStyle="bold" />

    </LinearLayout>

</LinearLayout>

Lalau abis membuat login kita langsung memuat activity berkut nya adalah memuat register, berikut coding di bawah ini.

RegisterActivity.java

package com.ilham;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class RegisterActivity extends AppCompatActivity {
    DatabaseHelper db;
    EditText mTextUsername;
    EditText mTextPassword;
    EditText mTextCnfPassword;
    Button mButtonRegister;
    TextView mTextViewLogin;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);

        db = new DatabaseHelper(this);
        mTextUsername = (EditText)findViewById(R.id.edittext_username);
        mTextPassword = (EditText)findViewById(R.id.edittext_password);
        mTextCnfPassword = (EditText)findViewById(R.id.edittext_cnf_password);
        mButtonRegister = (Button) findViewById(R.id.button_register);
        mTextViewLogin = (TextView) findViewById(R.id.textview_login);
        mTextViewLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent LoginIntent = new Intent(RegisterActivity.this,LoginActivity.class);
                startActivity(LoginIntent);
            }
        });

        mButtonRegister.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String user = mTextUsername.getText().toString().trim();
                String pwd = mTextPassword.getText().toString().trim();
                String cnf_pwd = mTextCnfPassword.getText().toString().trim();

                if (pwd.equals(cnf_pwd)) {
                    long val = db.addUser(user, pwd);
                    if (val > 0) {
                        Toast.makeText(RegisterActivity.this, "You have registered", Toast.LENGTH_SHORT).show();
                        Intent moveToLogin = new Intent(RegisterActivity.this, LoginActivity.class);
                        startActivity(moveToLogin);
                    } else {
                        Toast.makeText(RegisterActivity.this, "Restration Error", Toast.LENGTH_SHORT).show();
                    }

                } else {
                    Toast.makeText(RegisterActivity.this, "Password is not matching", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}

activity_register.xml

<?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"
    tools:context="com.ilham.RegisterActivity"
    android:orientation="vertical"
    android:layout_gravity="center_horizontal"
    android:background="#E91E63">

    <EditText
        android:id="@+id/edittext_username"
        android:layout_width="200dp"
        android:layout_height="40dp"
        android:layout_gravity="center"
        android:layout_marginTop="250dp"
        android:background="#ffffffff"
        android:drawableLeft="@drawable/username"
        android:hint="@string/username" />

    <EditText
        android:id="@+id/edittext_password"
        android:layout_width="200dp"
        android:layout_height="40dp"
        android:layout_gravity="center"
        android:layout_marginTop="20dp"
        android:background="#ffffffff"
        android:drawableLeft="@drawable/password"
        android:hint="@string/password" />

    <EditText
        android:id="@+id/edittext_cnf_password"
        android:layout_width="200dp"
        android:layout_height="40dp"
        android:layout_gravity="center"
        android:layout_marginTop="20dp"
        android:background="#ffffffff"
        android:drawableLeft="@drawable/password"
        android:hint="@string/confirm_password" />

    <Button
        android:id="@+id/button_register"
        android:layout_width="200dp"
        android:layout_height="50dp"
        android:layout_gravity="center"
        android:layout_marginTop="40dp"
        android:text="@string/register" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_gravity="center"
        android:layout_marginTop="10dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="35dp"
            android:textColor="#ffffffff"
            android:text="@string/already_registered"/>

        <TextView
            android:id="@+id/textview_login"
            android:layout_width="wrap_content"
            android:layout_height="35dp"
            android:textStyle="bold"
            android:paddingLeft="10dp"
            android:textColor="#ffffffff"
            android:textSize="16sp"
            android:text="@string/login"/>

    </LinearLayout>

</LinearLayout>

Dan selanjut nya akan membuat listview di berikut nya.

activity1.java

package com.ilham;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;


public class activity1 extends AppCompatActivity {
    ListView LV;
    String [] minuman={"Kunyit asam"," Beras kencur","Sinom","Wedang Secang","Wedang Jahe","Sarabba",
            "Bandrek","Lahang","Bir Pletok","Es Cingcau","Wedang Uwuh"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity12);

        LV = (ListView) findViewById(R.id.listView1);
        ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, minuman);
        LV.setAdapter(adapter);
        LV.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                                    long arg3) {
// TODO Auto-generated method stub
                int itemke = arg2;
                String itemText = (String) LV.getItemAtPosition(arg2);
                Toast.makeText(getBaseContext(), "Anda Meng Klik " + itemText, Toast.LENGTH_LONG).show();
                if (itemText.equals("Kunyit asam")) {
                    Intent SeninIntent = new Intent(arg0.getContext(), kunyitasam.class);
                    startActivityForResult(SeninIntent, 0);

                }
                if (itemText.equals("Beras kencur")) {
                    Intent SeninIntent = new Intent(arg0.getContext(), beraskencur.class);
                    startActivityForResult(SeninIntent, 0);

                }
                if (itemText.equals("Sinom")) {
                    Intent SeninIntent = new Intent(arg0.getContext(), sinom.class);
                    startActivityForResult(SeninIntent, 0);

                }
                if (itemText.equals("Wedang Secang")) {
                    Intent SeninIntent = new Intent(arg0.getContext(), wedangsecang.class);
                    startActivityForResult(SeninIntent, 0);

                }
                if (itemText.equals("Wedang Jahe")) {
                    Intent SeninIntent = new Intent(arg0.getContext(), wedangjahe.class);
                    startActivityForResult(SeninIntent, 0);

                }
                if (itemText.equals("Sarabba")) {
                    Intent SeninIntent = new Intent(arg0.getContext(), sarabba.class);
                    startActivityForResult(SeninIntent, 0);

                }
                if (itemText.equals("Bandrek")) {
                    Intent SeninIntent = new Intent(arg0.getContext(), bandrek.class);
                    startActivityForResult(SeninIntent, 0);

                }
                if (itemText.equals("Lahang")) {
                    Intent SeninIntent = new Intent(arg0.getContext(), lahang.class);
                    startActivityForResult(SeninIntent, 0);

                }
                if (itemText.equals("Bir Pletok")) {
                    Intent SeninIntent = new Intent(arg0.getContext(), birpletok.class);
                    startActivityForResult(SeninIntent, 0);

                }
                if (itemText.equals("Es Cingcau")) {
                    Intent SeninIntent = new Intent(arg0.getContext(), escingcau.class);
                    startActivityForResult(SeninIntent, 0);

                }
                if (itemText.equals("Wedang Uwuh")) {
                    Intent SeninIntent = new Intent(arg0.getContext(), wedanguwuh.class);
                    startActivityForResult(SeninIntent, 0);

                }

            }
        });

    }}

activity12.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@android:color/holo_orange_light"
    tools:context=".MainActivity" >

    <ListView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true" >
    </ListView>

</LinearLayout>

activity2.java

package com.ilham;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

public class activity2 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity22);

    }
}


activity22.xml

<?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:background="@android:color/holo_orange_light"
    tools:context=".activity2">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginStart="91dp"
        android:layout_marginLeft="91dp"
        android:layout_marginBottom="461dp"
        android:text="Sejarah Minuman Khas Indonesia"
        android:textColor="@android:color/background_dark" />

    <TextView
        android:layout_width="390dp"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginStart="12dp"
        android:layout_marginLeft="12dp"
        android:layout_marginBottom="287dp"
        android:text="Pada zaman dahulu jamu ini banyak diminum,dan diproduksi oleh para wanita,sebab pada masa itu pria lebih berperan untuk mencari tumbuhan herbal alami sebagai bahan dasar mengolah jamu.Umumnya jamu diminum sebagai obat alami untuk menjaga kesehatan,mencegah,serta dapat menyembuhkan berbagai macam penyakit.Jamu pun disajikan dengan berbagai jenis, karena di Indonesia sendiri tanaman herbal berjumlah cukup banyak" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true"
        android:layout_centerInParent="true"
        android:layout_marginStart="119dp"
        android:layout_marginLeft="119dp"
        android:layout_marginBottom="226dp"
        android:text="Manfaat jamu Tradisioal"
        android:textColor="@android:color/background_dark" />

    <TextView
        android:layout_width="392dp"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginStart="11dp"
        android:layout_marginLeft="11dp"
        android:layout_marginBottom="92dp"
        android:text="Sejarah minuman jamu sendiri banyak dikonsumsi untuk menjaga kesehatan tubuh, baik didalam maupun luar agar tetap sehat dan prima. Terdapat banyak jenis jamu yang populer di Indonesia, diantaranya ialah jamu beras kencur, jamu pahitan, jamu sehat laki-laki dan wanita, jamu kunyit asam, dan aneka jamu lainnya." />


</RelativeLayout>

activity3.java

package com.ilham;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

public class activity3 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity32);

        }
    }

activity32.xml

<?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:background="@android:color/holo_orange_light"
    tools:context=".activity3">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="327dp"
        android:text="Ujian UAS Mochamad Ilham Syaputra"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="62dp"
        android:text="©copyright - 2020"/>

</RelativeLayout>

kunyitasem.java

package com.ilham;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

public class kunyitasam extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.kunyitasam1);

        if (getSupportActionBar() != null) {
            getSupportActionBar().setTitle("Kunyit Asam");
        }
    }
}

kunyitasam1.xml

<?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"
    tools:context=".kunyitasam">

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/activity_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/holo_orange_light">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:adjustViewBounds="true"
                    android:scaleType="fitXY"
                    android:src="@drawable/kunyitasam1" />

            </FrameLayout>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textSize="32sp"
                android:text="Kunyit Asam"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginBottom="8dp"
                android:textColor="@android:color/black"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text=""
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="16dp"
                android:lineSpacingMultiplier="1"
                android:textColor="@android:color/black"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text=""
                android:textSize="12sp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="8dp"/>
            <TableLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="16dp">
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_marginRight="16dp"
                        android:text="Bahan"/>
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_weight="1"
                        android:text="Kunyit,Asam Jawa,Air"
                        android:textColor="@android:color/black"/>
                </TableRow>
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_marginRight="16dp"
                        android:text="Cara Buat"/>
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_weight="1"
                        android:text="mencuci bersih kunyit,kupas dan haluskan,rebus bersama asam jawa,garam dan air secujkupnya.Rebus hingga air mendidih."
                        android:textColor="@android:color/black"/>
                </TableRow>
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_marginRight="16dp"
                        android:text="Asal"/>
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_weight="1"
                        android:text="Indonesia"
                        android:textColor="@android:color/black"/>
                </TableRow>
            </TableLayout>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text=""
                android:textSize="12sp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="8dp"/>

        </LinearLayout>
    </ScrollView>

</RelativeLayout>

sinom.java

package com.ilham;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

public class sinom extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sinom1);

        if (getSupportActionBar() != null) {
            getSupportActionBar().setTitle("Sinom");
        }
    }
}

sinom1.xml

<?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"
    tools:context=".sinom">

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/activity_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/holo_orange_light">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:adjustViewBounds="true"
                    android:scaleType="fitXY"
                    android:src="@drawable/sinom1" />

            </FrameLayout>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textSize="32sp"
                android:text="Sinom"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginBottom="8dp"
                android:textColor="@android:color/black"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text=""
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="16dp"
                android:lineSpacingMultiplier="1"
                android:textColor="@android:color/black"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text=""
                android:textSize="12sp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="8dp"/>
            <TableLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="16dp">
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_marginRight="16dp"
                        android:text="Bahan"/>
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_weight="1"
                        android:text="Daun Asam Muda,Kunyit,Gula Merah,Air"
                        android:textColor="@android:color/black"/>
                </TableRow>
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_marginRight="16dp"
                        android:text="Cara Buat"/>
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_weight="1"
                        android:text="siapkan daun asam yang masih muda dan irisan kunyit,rebus dan tambahkan gula merah secukupnya."
                        android:textColor="@android:color/black"/>
                </TableRow>
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_marginRight="16dp"
                        android:text="Asal"/>
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_weight="1"
                        android:text="Indonesia"
                        android:textColor="@android:color/black"/>
                </TableRow>
            </TableLayout>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text=""
                android:textSize="12sp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="8dp"/>

        </LinearLayout>
    </ScrollView>

</RelativeLayout>

bandrek.java

bandrek1.xml

<?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"
    tools:context=".bandrek">

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/activity_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/holo_orange_light">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:adjustViewBounds="true"
                    android:scaleType="fitXY"
                    android:src="@drawable/bandrek1" />

            </FrameLayout>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textSize="32sp"
                android:text="Bandrek"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginBottom="8dp"
                android:textColor="@android:color/black"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text=""
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="16dp"
                android:lineSpacingMultiplier="1"
                android:textColor="@android:color/black"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="tes"
                android:textSize="12sp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="8dp"/>
            <TableLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="16dp">
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_marginRight="16dp"
                        android:text="Bahan"/>
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_weight="1"
                        android:text="jahe,gula aren,daun pandan,kayu manis,cengkeh,garam."
                        android:textColor="@android:color/black"/>
                </TableRow>
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_marginRight="16dp"
                        android:text="Cara Buat"/>
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_weight="1"
                        android:text="campur semuah bahan dan di sajikan sesuai takeran."
                        android:textColor="@android:color/black"/>
                </TableRow>
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_marginRight="16dp"
                        android:text="Asal"/>
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="14sp"
                        android:layout_weight="1"
                        android:text="Indonesia"
                        android:textColor="@android:color/black"/>
                </TableRow>
            </TableLayout>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text=""
                android:textSize="12sp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="8dp"/>

        </LinearLayout>
    </ScrollView>

</RelativeLayout>

Ini hasil akihirnya seperti di gambar di atas. Kurang lebih saya mohon maaf dan terimakasih semoga bermanfaat dan membantu dalam tugas uas saya. Terima Kasih.

Mochamad Ilham Syaputra

161021450091

06TPLM001

Moblie Programing

Tinggalkan komentar

Rancang situs seperti ini dengan WordPress.com
Mulai