zoukankan      html  css  js  c++  java
  • 第七次作业

    <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"
        tools:context="com.example.qq.MyActivity" >
    
        <TextView
            android:id="@+id/tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_marginBottom="20dp"
             />
    
         <TextView
             android:id="@+id/tv1"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignLeft="@+id/tv"
             android:layout_below="@+id/tv"
             android:gravity="center_vertical"
              />
    
    </RelativeLayout>
    <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:background="#e7e7e7"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.example.qq.MainActivity" >
    
        <LinearLayout 
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:orientation="vertical">
           
                <LinearLayout 
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:orientation="vertical"
                 android:layout_weight="1">
    
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_weight="1"
                        android:orientation="vertical" >
                            <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="1"
                            android:orientation="vertical" >
                        </LinearLayout>
                         <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="1"
                            android:orientation="vertical" >
                              <ImageView 
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:src="@drawable/tx"
                                android:layout_marginBottom="10dp"
                               />
                        </LinearLayout>
                    </LinearLayout>
                         
                         <LinearLayout 
                         android:layout_width="match_parent"
                         android:layout_height="match_parent"
                         android:orientation="vertical"
                         android:layout_weight="1">
                                     <LinearLayout 
                                     android:layout_width="match_parent"
                                     android:layout_height="match_parent"
                                     android:orientation="horizontal"
                                     android:background="#ffffff"
                                     android:layout_weight="1"
                                     android:layout_marginBottom="2dp">
                                     <TextView
                                         android:layout_width="0dp"
                                         android:layout_height="match_parent"
                                         android:layout_weight="1"
                                         android:background="#ffffff"
                                         android:text="账号"
                                         android:gravity="center_vertical"
                                         android:layout_marginLeft="10dp"
                                         />
                                      <EditText 
                                         android:id="@+id/admin"
                                         android:layout_width="0dp"
                                         android:layout_height="match_parent"
                                         android:layout_weight="9"
                                         android:hint="QQ账号"
                                         android:background="#ffffff"
                                          />
                                      <TextView 
                                            android:id="@+id/yadmin" 
                                            android:layout_width="0dp"
                                            android:layout_height="0dp"
                                            android:text="123456"
                                                               />
                                      </LinearLayout>
                                      <LinearLayout 
                                     android:layout_width="match_parent"
                                     android:layout_height="match_parent"
                                     android:background="#ffffff"
                                     android:layout_weight="1"
                                     android:layout_marginTop="2dp">
                                      <TextView
                                         android:layout_width="0dp"
                                         android:layout_height="match_parent"
                                         android:layout_weight="1"
                                         android:background="#ffffff"
                                         android:text="密码"
                                         android:gravity="center_vertical"
                                         android:layout_marginLeft="10dp"
                                         />
    
                                      <EditText
                                         android:id="@+id/password"
                                         android:layout_width="0dp"
                                         android:layout_height="match_parent"
                                         android:layout_weight="9"
                                         android:hint="密码"
                                         android:background="#ffffff"
                                         android:inputType="textPassword"
                                          />
                                     </LinearLayout>
                         </LinearLayout>
                 </LinearLayout>
           
           
           <LinearLayout 
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:orientation="vertical"
           android:layout_weight="1">
                       <LinearLayout 
                       android:layout_marginTop="40dp"
                       android:layout_width="match_parent"
                       android:layout_height="0dp"
                       android:layout_weight="1"
                       >
                         <Button 
                         android:id="@+id/Login"
                         android:layout_width="match_parent"
                         android:layout_height="match_parent"
                         android:text="登录"
                         android:textColor="#ffffff"
                         android:background="#398ec6"
                         android:onClick="click"
                             />
                       </LinearLayout>
                       <LinearLayout 
                       android:layout_width="match_parent"
                       android:layout_height="0dp"
                       android:layout_weight="3">
                       </LinearLayout>
           </LinearLayout>
           </LinearLayout>
    </RelativeLayout>
    package com.example.qq;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.widget.TextView;
    
    public class MyActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_my);
            TextView tv = (TextView) findViewById(R.id.tv);
            TextView tv2 = (TextView) findViewById(R.id.tv1);
            
            Intent intent =getIntent();
            String text =intent.getStringExtra("admin");
            Log.v("520lj", text+"");
            tv.setText("账号"+text+"");
            String text2 = intent.getStringExtra("username");
            tv2.setText("密码"+text2+"");
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.my, menu);
            return true;
        }
    
        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            // Handle action bar item clicks here. The action bar will
            // automatically handle clicks on the Home/Up button, so long
            // as you specify a parent activity in AndroidManifest.xml.
            int id = item.getItemId();
            if (id == R.id.action_settings) {
                return true;
            }
            return super.onOptionsItemSelected(item);
        }
    }
    package com.example.qq;
    
    
    
    
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.TextView;
    import android.widget.Toast;
    
    public class MainActivity extends Activity {
         
        @Override
        protected void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
             setContentView(R.layout.activity_main);
             Button  Login =(Button) findViewById(R.id.Login);
            
    
             Login.setOnClickListener(new View.OnClickListener() {
                    TextView textView;
                    @Override
                    public void onClick(View view) {
                         EditText admin= (EditText) findViewById(R.id.admin);
                         EditText password= (EditText) findViewById(R.id.password);
                         String admin1=admin.getText().toString().trim();
                         String password1=password.getText().toString().trim();
                        // TODO Auto-generated method stub
                        if("123456".equals(admin1)&&"adc123".equals(password1)){
                        Toast.makeText(MainActivity.this,"登录成功",0).show();
                        Intent intent = new Intent();
                        intent.putExtra("admin", admin1);
                        intent.putExtra("username", password1);
                        intent.setAction("com.example.qq.action.haha");
                        startActivity(intent);
                    }else{
                        Toast.makeText(MainActivity.this,"登录失败",0).show();
                    }
                        
                    }
                });
        }
        
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.main, menu);
            return true;
        }
    
        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            // Handle action bar item clicks here. The action bar will
            // automatically handle clicks on the Home/Up button, so long
            // as you specify a parent activity in AndroidManifest.xml.
            int id = item.getItemId();
            if (id == R.id.action_settings) {
                return true;
            }
            return super.onOptionsItemSelected(item);
        }
    }

  • 相关阅读:
    springcloud 项目源码 微服务 分布式 Activiti6 工作流 vue.js html 跨域 前后分离
    springcloud 项目源码 微服务 分布式 Activiti6 工作流 vue.js html 跨域 前后分离
    OA办公系统 Springboot Activiti6 工作流 集成代码生成器 vue.js 前后分离 跨域
    java企业官网源码 自适应响应式 freemarker 静态引擎 SSM 框架
    java OA办公系统源码 Springboot Activiti工作流 vue.js 前后分离 集成代码生成器
    springcloud 项目源码 微服务 分布式 Activiti6 工作流 vue.js html 跨域 前后分离
    java 视频播放 弹幕技术 视频弹幕 视频截图 springmvc mybatis SSM
    最后阶段总结
    第二阶段学习总结
    第一阶段学习总结
  • 原文地址:https://www.cnblogs.com/zqxxx/p/11664772.html
Copyright © 2011-2022 走看看