안드로이드

 

 

  compile 'com.android.volley:volley:1.0.0'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.volley:volley:1.0.0'
    testCompile 'junit:junit:4.12'
}

 

 

class LoginActivity

package kr.co.dothome.braverokmc.managerment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

//로그인 초기 화면
public class LoginActivity extends AppCompatActivity {


    EditText idText, pswordText;
    Button loginButton;

    TextView registerBtn;

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


        idText =(EditText)findViewById(R.id.idText);
        pswordText =(EditText)findViewById(R.id.pswordText);
        registerBtn =(TextView)findViewById(R.id.registerBtn);
        loginButton=(Button)findViewById(R.id.loginButton);



        registerBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent(LoginActivity.this, RegisterActivity.class);
                startActivity(intent);
            }
        });
    }
}









 

R.layout.login_main)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="kr.co.dothome.braverokmc.managerment.LoginActivity">

    <EditText
        android:id="@+id/idText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:ems="10"
        android:hint="아이디"
        android:inputType="textPersonName" />

    <EditText
        android:id="@+id/text1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/idText"
        android:ems="10"
        android:hint="비밀번호"
        android:inputType="textPassword" />

    <Button
        android:id="@+id/loginButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/text1"
        android:layout_marginTop="86dp"
        android:text="로그인" />

    <TextView
        android:id="@+id/registerBtn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/loginButton"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="40dp"
        android:text="회원가입"
        android:textAppearance="@style/TextAppearance.AppCompat" />
</RelativeLayout>

 

 

 class MainActivity

package kr.co.dothome.braverokmc.managerment;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;


//로그인 성공시
public class MainActivity extends AppCompatActivity {


    TextView idText, pswordText, welcome;


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


        idText =(TextView)findViewById(R.id.idText);
        pswordText =(TextView)findViewById(R.id.pswordText);
        welcome=(TextView)findViewById(R.id.welcome);

    }
}

 

R.layout.activity_main

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="kr.co.dothome.braverokmc.managerment.MainActivity">

    <TextView
        android:id="@+id/welcome"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="TextView"
        android:textAppearance="@style/TextAppearance.AppCompat.Display1"
        />

    <TextView
        android:id="@+id/idTextText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="아이디"
        android:textAppearance="@style/TextAppearance.AppCompat.Headline" />

    <TextView
        android:id="@+id/idText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="TextView"
        android:textAppearance="@style/TextAppearance.AppCompat.Display1" />


    <TextView
        android:id="@+id/text1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="비밀번호"
        android:textAppearance="@style/TextAppearance.AppCompat.Headline" />

    <TextView
        android:id="@+id/pswordText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="TextView"
        android:textAppearance="@style/TextAppearance.AppCompat.Display1" />


</LinearLayout>

 

 

 

class RegisterActivity

package kr.co.dothome.braverokmc.managerment;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.EditText;

public class RegisterActivity extends AppCompatActivity {

    EditText idText, pswordText, nameText, ageText;
    Button registerButton;

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

        idText =(EditText)findViewById(R.id.idText);
        pswordText =(EditText)findViewById(R.id.pswordText);
        nameText =(EditText)findViewById(R.id.nameText);
        ageText =(EditText)findViewById(R.id.ageText);

        registerButton=(Button)findViewById(R.id.registerbutton);


    }


}

 

R.layout.activity_register

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="kr.co.dothome.braverokmc.managerment.RegisterActivity">

    <EditText
        android:id="@+id/idText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:ems="10"
        android:hint="아이디"
        android:inputType="textPersonName" />

    <EditText
        android:id="@+id/pswordText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="비밀번호"
        android:inputType="textPassword" />

    <EditText
        android:id="@+id/nameText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="18dp"
        android:ems="10"
        android:hint="이름"
        android:inputType="textPersonName" />

    <EditText
        android:id="@+id/ageText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="나이"
        android:inputType="textPersonName" />

    <Button
        android:id="@+id/registerbutton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_centerVertical="true"
        android:text="회원가입" />



</LinearLayout>

 

 

 

 

 

 

 

 

 

 

about author

PHRASE

Level 60  머나먼나라

Appearances are deceptive. (열 길 물 속은 알아도 한 치 사람의 마음 속은 모른다.)

댓글 ( 0)

댓글 남기기

작성