Android App Login Screen

Android App Login Screen

Source code introduction: Simple Android App login interface

Source code effect:

Source code snippet:

  1. public   class LoginActivity extends ActionBarActivity {
  2.   
  3. private Context context;
  4.   
  5. @Override  
  6. protected   void onCreate(Bundle savedInstanceState) {
  7. super .onCreate(savedInstanceState);
  8. setContentView(R.layout.activity_login);
  9.   
  10. context = getApplicationContext();
  11.   
  12. createLogo();
  13. createToast(R.id.tvNext, "Next" );
  14. createToast(R.id.tvSignup, "Sign Up" );
  15. createToast(R.id.tvPolicy, "Privacy Policy" );
  16. createToast(R.id.tvForgot, "Forgot Password, huh?" );
  17. createLoginEvent();
  18. }
  19.   
  20. private   void createLogo(){
  21. Typeface vibeFont = Typeface.createFromAsset(getAssets(), "fonts/GreatVibes-Regular.otf" );
  22. TextView tvLogo = (TextView) findViewById(R.id.tvLogo);
  23. tvLogo.setTypeface(vibeFont);
  24. }
  25.   
  26. private   void createToast( int viewId, final String text){
  27. TextView view = (TextView) findViewById(viewId);
  28. view.setOnClickListener( new View.OnClickListener() {
  29. @Override  
  30. public   void onClick(View v) {
  31. Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
  32. }
  33. });
  34. }
  35.   
  36. private   void createLoginEvent(){
  37. EditText etPassword = (EditText) findViewById(R.id.etPassword);
  38. etPassword.setOnKeyListener( new View.OnKeyListener() {
  39. @Override  
  40. public   boolean onKey(View v, int keyCode, KeyEvent event) {
  41. if (keyCode == KeyEvent.KEYCODE_ENTER) {
  42. Toast.makeText(context, "Logging in.." , Toast.LENGTH_SHORT).show();
  43. }
  44. return   false ;
  45. }
  46. });
  47. }
  48.   
  49.   
  50. @Override  
  51. public   boolean onCreateOptionsMenu(Menu menu) {
  52. // Inflate the menu; this adds items to the action bar if it is present.  
  53. getMenuInflater().inflate(R.menu.menu_login, menu);
  54. return   true ;
  55. }
  56.   
  57. @Override  
  58. public   boolean onOptionsItemSelected(MenuItem item) {
  59. // Handle action bar item clicks here. The action bar will  
  60. // automatically handle clicks on the Home/Up button, so long  
  61. // as you specify a parent activity in AndroidManifest.xml.  
  62. int id = item.getItemId();
  63.   
  64. //noinspection SimplifiableIfStatement  
  65. if (id == R.id.action_settings) {
  66. return   true ;
  67. }
  68.   
  69. return   super .onOptionsItemSelected(item);
  70. }
  71. }

Download address: http://download..com/data/2115241

<<:  Third-party login

>>:  How good is the product manager in a programmer’s dream?

Recommend

Analysis of Xigua Video's Competitive Products

In early 2021, Xigua Video anchored mid-length vi...

Learn how to set up SEM search bidding flash in 10 minutes

When I first entered the industry, I was in a hur...

Information flow delivery trends of Bytedance, Baidu, and Guangdiantong in 2022!

Today, let’s take a look at the three major infor...

P2P activity operation process and skills!

I started working at this financial company in th...

4 elements to effectively increase user growth!

In the circle, whenever the word "growth&quo...

Catching Fireballs

At 02:06 in the morning of November 29, a white l...