Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:padding="20dp">
- <RelativeLayout
- android:id="@+id/layoutLogin"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <EditText
- android:id="@+id/edtUserName"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:hint="Eneter user name"
- />
- <EditText
- android:id="@+id/edtUserPassword"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/edtUserName"
- android:hint="Eneter user Password"
- />
- <Button
- android:id="@+id/btnLogin"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:text="Login"
- />
- </RelativeLayout>
- <RelativeLayout
- android:id="@+id/layoutProfile"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="gone">
- <ImageView
- android:id="@+id/ImgUserProfile"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_margin="20dp"
- android:src="@mipmap/ic_launcher"
- />
- <LinearLayout
- android:id="@+id/Namee"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/ImgUserProfile">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/ImgUserProfile"
- android:layout_weight="3"
- android:text="Name: " />
- <EditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- />
- </LinearLayout>
- <LinearLayout
- android:id="@+id/LNamee"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/Namee">
- <TextView
- android:id="@+id/edtN"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="3"
- android:text="LastName: " />
- <EditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- />
- </LinearLayout>
- <LinearLayout
- android:id="@+id/Addres"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/LNamee">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="3"
- android:text="Addres: " />
- <EditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- />
- </LinearLayout>
- <LinearLayout
- android:id="@+id/Phoneid"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/Addres">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="3"
- android:text="Phone: " />
- <EditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- />
- </LinearLayout>
- </RelativeLayout>
- </RelativeLayout>
- MainActivity
- package com.example.student.myapplication;
- import android.app.ListActivity;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.ArrayAdapter;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.ListView;
- import android.widget.RelativeLayout;
- import android.widget.Toast;
- public class MainActivity extends AppCompatActivity {
- //init
- Button btnLogin;
- EditText editTextUserName,editTextUserPassword;
- RelativeLayout layoutProfil,layoutLogin;
- ListView lista;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.slusateli);
- // initComponents();
- //setComponents();
- lista=(ListView) findViewById(R.id.listaSlusateli);
- String [] slusateli=new String[]{
- "Ilir",
- "Besar",
- "Igor",
- "Eljesa",
- "Stefan",
- "Ilija",
- "Jovanka",
- "Stefan"
- };
- ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,slusateli);
- lista.setAdapter(adapter);
- }
- /*
- public void initComponents(){
- btnLogin=(Button) findViewById(R.id.btnLogin);
- editTextUserName =(EditText) findViewById(R.id.edtUserPassword);
- editTextUserPassword=(EditText) findViewById(R.id.edtUserPassword);
- layoutProfil=(RelativeLayout) findViewById(R.id.layoutProfile);
- layoutLogin= (RelativeLayout) findViewById(R.id.layoutLogin);
- lista=(ListView) findViewById(R.id.listaSlusateli);
- }
- */
- public void setComponents(){
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- String msg="Yoou click me"+editTextUserPassword.getText()+editTextUserName.getText();
- Toast.makeText(MainActivity.this,"You click me",Toast.LENGTH_SHORT).show();
- layoutLogin.setVisibility(View.GONE);
- layoutProfil.setVisibility(View.VISIBLE);
- }
- });
- btnLogin.setOnLongClickListener( view->
- {
- String msg="Yoou click me"+editTextUserPassword.getText()+editTextUserName.getText();
- Toast.makeText(MainActivity.this,"Onlong",Toast.LENGTH_SHORT).show();
- return false;
- }
- );
- }
- }
- Slusateli
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical" android:layout_width="match_parent"
- android:layout_height="match_parent">
- <ListView
- android:id="@+id/listaSlusateli"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:dividerHeight="1dp"
- >
- </ListView>
- </LinearLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement