本文讲述了在linux命令下导出导入.sql文件的方法。分享给大家供大家参考,具体如下:

AndroidManifest.xml

代码语言:javascript

<?xml version="1.0" encoding="utf-8"?  
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
 package="online.geekgalaxy.layoutlearn"  
 <application 
 android:allowBackup="true" 
 android:icon="@mipmap/ic_launcher" 
 android:label="@string/app_name" 
 android:roundIcon="@mipmap/ic_launcher_round" 
 android:supportsRtl="true" 
 android:theme="@style/AppTheme"  
 <activity android:name=".MainActivity"  
  <intent-filter  
  <action android:name="android.intent.action.MAIN" /  
  <category android:name="android.intent.category.LAUNCHER" /  
  </intent-filter  
 </activity  
 <activity android:name=".login"  
  <intent-filter  
  <action android:name="android.intent.action.MAIN" /  
  </intent-filter  
 </activity  
 <activity android:name=".register"  
  <intent-filter  
  <action android:name="android.intent.action.MAIN" /  
  </intent-filter  
 </activity  
 </application  
</manifest
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.

MainActivity.java

代码语言:javascript

package online.geekgalaxy.layoutlearn; 
import android.content.DialogInterface; 
import android.content.Intent; 
import android.support.v7.app.AlertDialog; 
import android.support.v7.app.AppCompatActivity; 
import android.os.Bundle; 
import android.view.View; 
import android.widget.Button; 
import android.widget.EditText; 
public class MainActivity extends AppCompatActivity { 
 @Override 
 protected void onCreate(Bundle savedInstanceState) { 
 super.onCreate(savedInstanceState); 
 setContentView(R.layout.activity_main); 
 //login button 
 final Button login = (Button) findViewById(R.id.button); 
 final String user = "admin"; 
 final String pass = "hello"; 
 
 login.setOnClickListener(new View.OnClickListener() { 
  public void onClick(View view) { 
  String username = ""; 
  EditText editText1 = (EditText)findViewById(R.id.editText); 
  username = editText1.getText().toString(); 
  String password = ""; 
  EditText editText2 = (EditText)findViewById(R.id.editText2); 
  password = editText2.getText().toString(); 
  if (username.equals(user) & password.equals(pass)) { 
   Intent intent = new Intent(MainActivity.this, login.class); 
   startActivity(intent); 
  } 
  else { 
   new AlertDialog.Builder(MainActivity.this).setTitle("Error!").setMessage("Wrong username or password.") 
    .setNegativeButton("OK",null) 
    .show(); 
  } 
  } 
 }); 
 //register button 
 final Button register = (Button) findViewById(R.id.button2); 
 register.setOnClickListener(new View.OnClickListener() { 
  public void onClick(View view) { 
  //提示框确定是否跳转 
  new AlertDialog.Builder(MainActivity.this).setTitle("Jump").setMessage("Ready to jump?") 
   .setPositiveButton("Yes", new DialogInterface.OnClickListener() { 
    public void onClick(DialogInterface dialog, int which) { 
    Intent intent = new Intent(MainActivity.this, register.class); 
    startActivity(intent); 
    }}) 
   .setNegativeButton("No",null) 
   .show(); 
  } 
 }); 
 } 
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.

login.java

代码语言:javascript

package online.geekgalaxy.layoutlearn; 
import android.app.Activity; 
import android.os.Bundle; 
/** 
 * Created by jailman on 2017/9/18. 
 */ 
public class login extends Activity { 
 @Override 
 protected void onCreate(Bundle savedInstanceState) { 
 super.onCreate(savedInstanceState); 
 setContentView(R.layout.login); 
 } 
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.

register.java

代码语言:javascript

package online.geekgalaxy.layoutlearn; 
import android.app.Activity; 
import android.os.Bundle; 
/** 
 * Created by jailman on 2017/9/18. 
 */ 
public class register extends Activity{ 
 @Override 
 protected void onCreate(Bundle savedInstanceState) { 
 super.onCreate(savedInstanceState); 
 setContentView(R.layout.register); 
 } 
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.

activity_main.xml

代码语言:javascript

<?xml version="1.0" encoding="utf-8"?  
<android.support.constraint.ConstraintLayout 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_centerVertical="true" 
tools:context="online.geekgalaxy.layoutlearn.MainActivity"  
<Button 
android:id="@+id/button" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_marginRight="68dp" 
android:text="@string/login" 
app:layout_constraintRight_toLeftOf="@+id/button2" 
tools:layout_constraintTop_creator="1" 
android:layout_marginEnd="68dp" 
android:layout_marginTop="26dp" 
app:layout_constraintTop_toBottomOf="@+id/editText2" /  
<Button 
android:id="@+id/button2" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:text="@string/register" 
tools:layout_constraintTop_creator="1" 
tools:layout_constraintRight_creator="1" 
android:layout_marginEnd="68dp" 
app:layout_constraintRight_toRightOf="parent" 
android:layout_marginTop="26dp" 
app:layout_constraintTop_toBottomOf="@+id/editText2" /  
<EditText 
android:id="@+id/editText" 
android:layout_width="240dp" 
android:layout_height="45dp" 
android:layout_marginBottom="35dp" 
android:layout_marginEnd="68dp" 
android:layout_marginLeft="8dp" 
android:layout_marginRight="8dp" 
android:layout_marginStart="68dp" 
android:ems="10" 
android:hint="@string/username" 
android:inputType="textPersonName" 
app:layout_constraintBottom_toTopOf="@+id/editText2" 
app:layout_constraintHorizontal_bias="0.516" 
app:layout_constraintLeft_toLeftOf="@+id/editText2" 
app:layout_constraintRight_toRightOf="@+id/editText2" 
tools:layout_constraintLeft_creator="1" 
tools:layout_constraintRight_creator="1" 
tools:layout_editor_absoluteX="-15dp" 
tools:layout_editor_absoluteY="152dp" /  
<EditText 
android:id="@+id/editText2" 
android:layout_width="240dp" 
android:layout_height="45dp" 
android:layout_marginEnd="69dp" 
android:layout_marginLeft="0dp" 
android:layout_marginRight="0dp" 
android:layout_marginStart="69dp" 
android:ems="10" 
android:hint="@string/password" 
android:inputType="textPassword" 
app:layout_constraintBottom_toBottomOf="parent" 
app:layout_constraintLeft_toLeftOf="@+id/button" 
app:layout_constraintRight_toRightOf="@+id/button2" 
app:layout_constraintTop_toTopOf="parent" 
tools:layout_constraintBottom_creator="1" 
tools:layout_constraintLeft_creator="1" 
tools:layout_constraintRight_creator="1" 
tools:layout_constraintTop_creator="1" /  
<TextView 
android:id="@+id/textView2" 
android:layout_width="250dp" 
android:layout_height="65dp" 
android:layout_marginBottom="50dp" 
android:layout_marginLeft="8dp" 
android:layout_marginRight="8dp" 
android:autoText="false" 
android:text="Welcome" 
android:textAlignment="center" 
android:textSize="50sp" 
android:textStyle="bold" 
app:layout_constraintBottom_toTopOf="@+id/editText" 
app:layout_constraintHorizontal_bias="0.509" 
app:layout_constraintLeft_toLeftOf="@+id/editText" 
app:layout_constraintRight_toRightOf="@+id/editText" /  
</android.support.constraint.ConstraintLayout
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.

login.xml

代码语言:javascript

<?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" 
android:weightSum="1"  
<TextView 
android:id="@+id/textView3" 
android:layout_width="0dp" 
android:layout_height="118dp" 
android:layout_marginTop="200dp" 
android:layout_weight="1" 
android:text="@string/great_you_ve_login" 
android:textAlignment="center" 
android:textSize="24sp" 
android:textStyle="bold" /  
</LinearLayout
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.

register.xml

代码语言:javascript

<?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"  
<LinearLayout 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:gravity="center_vertical|center_horizontal" 
android:orientation="vertical"  
<EditText 
android:id="@+id/editText5" 
android:layout_width="270dp" 
android:layout_height="wrap_content" 
android:ems="10" 
android:hint="Username" 
android:inputType="textPersonName" /  
<EditText 
android:id="@+id/editText6" 
android:layout_width="270dp" 
android:layout_height="wrap_content" 
android:ems="10" 
android:hint="Email" 
android:inputType="textPersonName" /  
<EditText 
android:id="@+id/editText7" 
android:layout_width="270dp" 
android:layout_height="wrap_content" 
android:ems="10" 
android:hint="Password" 
android:inputType="textPassword" /  
<EditText 
android:id="@+id/editText8" 
android:layout_width="270dp" 
android:layout_height="wrap_content" 
android:ems="10" 
android:hint="Confirm password" 
android:inputType="textPassword" /  
<Button 
android:id="@+id/button3" 
android:layout_width="270dp" 
android:layout_height="wrap_content" 
android:text="Submit" /  
</LinearLayout  
</LinearLayout
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.

strings.xml

代码语言:javascript

<resources  
<string name="app_name" LayoutLearn</string  
<string name="login" Login</string  
<string name="register" Register</string  
<string name="username" Username</string  
<string name="password" Password</string  
<string name="great_you_ve_login" Great, you\'ve logged in!</string  
</resources
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.

build.gradle

代码语言:javascript

apply plugin: 'com.android.application' 
android { 
compileSdkVersion 25 
buildToolsVersion "25.0.3" 
defaultConfig { 
applicationId "online.geekgalaxy.layoutlearn" 
minSdkVersion 19 
targetSdkVersion 25 
versionCode 1 
versionName "1.0" 
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 
buildTypes { 
release { 
minifyEnabled false 
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
} 
} 
} 
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' 
testCompile 'junit:junit:4.12' 
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.

Android实现注册登录界面的实例代码_android

Android实现注册登录界面的实例代码_xml_02

Android实现注册登录界面的实例代码_Text_03

Android实现注册登录界面的实例代码_android_04

Android实现注册登录界面的实例代码_android_05

更多Android进阶指南 可以扫码 解锁 《Android十大板块文档》

1.Android车载应用开发系统学习指南(附项目实战)

2.Android Framework学习指南,助力成为系统级开发高手

3.2024最新Android中高级面试题汇总+解析,告别零offer

4.企业级Android音视频开发学习路线+项目实战(附源码)

5.Android Jetpack从入门到精通,构建高质量UI界面

6.Flutter技术解析与实战,跨平台首要之选

7.Kotlin从入门到实战,全方面提升架构基础

8.高级Android插件化与组件化(含实战教程和源码)

9.Android 性能优化实战+360°全方面性能调优

10.Android零基础入门到精通,高手进阶之路

敲代码不易,关注一下吧。ღ( ´・ᴗ・` ) 🤔