zoukankan      html  css  js  c++  java
  • 第三次作业--QQ登录界面简单制作



    import
    android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void CCC(View view) { // TODO Auto-generated method stub Button btn=(Button)findViewById(R.id.btn); EditText password = (EditText)findViewById(R.id.password); EditText name=(EditText)findViewById(R.id.name); String txt1=name.getText().toString(); String txt2=password.getText().toString(); if (txt1.equals("123456")&& txt2.equals("123456")) { Toast.makeText(MainActivity.this, "登录成功", 0).show(); }else { Toast.makeText(MainActivity.this, "登录失败", 0).show(); TextView tv2=(TextView)findViewById(R.id.tv2); tv2.setText("登陆失败"); } } }
    <RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:background="#e1ffff"
        tools:context="com.example.qq.MainActivity" >
    
     <ImageView
         android:id="@+id/login_icon"
         android:layout_width="80dp"
         android:layout_height="80dp"
         android:layout_alignParentTop="true"
         android:layout_centerHorizontal="true"
         android:src="@drawable/ic_qqq" />
     
    <EditText
               android:id="@+id/name"
               android:layout_width="match_parent"
               android:layout_height="40dp"
               android:layout_alignLeft="@+id/password"
               android:background="#ffffff"
               android:layout_marginTop="100dp"
               android:paddingLeft="20dp"
               android:hint="账号"
               android:maxLines="2"
               android:textColor="#000000"
               android:textSize="14sp" />
    <EditText
            android:id="@+id/password"
            android:layout_width="match_parent"
            android:layout_height="40dp"
              android:layout_marginTop="5dp"
            android:layout_below="@+id/name"
            android:hint="密码"
              android:inputType="textPassword"
            android:maxLines="2"
            android:paddingLeft="20dp"
            android:background="#ffffff"
            android:textColor="#000000"
            android:textSize="14sp" />
    <Button
            android:id="@+id/btn"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/password"
            android:text="登录"
            android:layout_marginTop="20dp"
            android:textColor="#ffffff"
            android:background="#00bfff"
            android:textSize="16sp"
            android:textStyle="italic"
            android:gravity="center"
            android:onClick="CCC"
            />
     <TextView 
             android:id="@+id/tv1"
               android:layout_width="wrap_content"
                android:layout_height="wrap_content"
             android:layout_alignLeft="@+id/name"
             android:layout_weight="1"
             android:layout_marginTop="300dp"
             android:text="无法登陆?"
               
               />
    
     <TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"

    
              android:layout_alignRight="@+id/name"
              android:layout_weight="1"
              android:layout_marginTop="300dp"
              android:text="新用户注册" />
    
     <TextView
         android:id="@+id/tv2"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_below="@+id/btn"
         android:layout_centerHorizontal="true"
         android:gravity="center"
         android:textStyle="italic" />

  • 相关阅读:
    PCB CE工具取Genesis JOB与STEP内存地址 方法分享
    PCB 720全景图嵌入登入界面应用实现
    PCB 录屏工具Screen2Exe GifCam ScreenToGif
    Centos部署hexo
    npm俩种换源方式
    腾讯云Centos下安装FastDFS
    远程连接docker容器里的MySQL出现2058
    CentOS7.6安装docker
    数据结构与算法(3)---链表
    java实现自定义图
  • 原文地址:https://www.cnblogs.com/wangtianpeng/p/11488637.html
Copyright © 2011-2022 走看看