任务二

任务二

样式,群里有APK自己下载吧。我这里就不展示了

可以实现的功能;
1、注册,
2、修改、
3、显示头像,
4、延时跳转
5、记住密码

任务时间: 下周日之前吧,也不是很难

功能:
1.实现记住密码操作
看下边这个连接
https://juejin.im/post/5adc444df265da0b886d00bc
2.学会使用ImageView
https://www.cnblogs.com/plokmju/p/android__ImageView.html
3.ImageView显示图库选择的图片(点击Imageview跳转到手机图库,选择图片返回 Imageview显示的是在图库选择的图片)
看这个链接

 private static final int IMAGE_REQUEST_CODE = 2;
 img_pic.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //在这里跳转到手机系统相册里面
                Intent intent = new Intent(
                        Intent.ACTION_PICK,
                        android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                startActivityForResult(intent, IMAGE_REQUEST_CODE);
                TS("穿越成功~~");
            }
        });
//返回从图库获取的图片信息
 @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        //在相册里面选择好相片之后调回到现在的这个activity中
        switch (requestCode) {
            case IMAGE_REQUEST_CODE://这里的requestCode是我自己设置的,就是确定返回到那个Activity的标志
                if (resultCode == RESULT_OK) {//resultCode是setResult里面设置的code值
                    try {
                        Uri selectedImage = data.getData(); //获取系统返回的照片的Uri
                        String[] filePathColumn = {MediaStore.Images.Media.DATA};
                        Cursor cursor = getContentResolver().query(selectedImage,
                                filePathColumn, null, null, null);//从系统表中查询指定Uri对应的照片
                        cursor.moveToFirst();
                        int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
                        path = cursor.getString(columnIndex);  //获取照片路径
                        cursor.close();
                        Bitmap bitmap = BitmapFactory.decodeFile(path);
                        //旋转图片
                        bitmap = changPic(bitmap, path);
                        img_pic.setImageBitmap(bitmap);
                        //把图片路径存起来
                        editor.putString("path", path);
                        editor.commit();
                    } catch (Exception e) {
                        // TODO Auto-generatedcatch block
                        e.printStackTrace();
                    }
                }
                break;
        }
    }

4.学会使用单选框
外层需要RadioGroup

<RadioGroup
                android:id="@+id/rg_two"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal">

                <RadioButton
                    android:id="@+id/rb_name"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="修改头像" />

                <RadioButton
                    android:id="@+id/rb_pwd"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:checked="true"
                    android:text="不修改头像" />
</RadioGroup>

5.学会LinearLayout布局 注册界面使用LinearLayout布局来写
6.输入信息的时候要判断是否为空逻辑是否正确。
7.这次任务如果部分注册、修改密码、修改名字不理解 没事。下次任务我们将会学习数据库。这次只是过渡。
8.修改密码的逻辑,还有创建账户的逻辑要思考一下。这里的密码我们采用的是明文,用到数据库的时候将会加密一下。
源码在下边

注册界面

这里我用的Imageview和你们要用的不一样。我用的是CircleImageView 你们把这个换成Imageview就行了 使用方法一样

存储信息只是过渡,下个任务将会学数据库,用数据库就会好很多。
在这个项目里头像是不会根据用户改变而改变的,用到数据库的时候就可以了,你们只需要完成能更改Imageview显示的图片就行

登录界面源码:

public class MainActivity extends AppCompatActivity {

    //定义控件
    //这里就像java里边那样 需要int值就定义int类型的变量
    //但是这是Android 我们需要控件  所以需要定义控件
    //界面上一共放了四个空间  我们需要获取两个输入框的值和Button的点击事件
    /*
    还有选择框的选中事件  所以就定义四个控件
     */
    private Button btn_send;
    private EditText ed_name;
    private EditText ed_pwd;
    private CheckBox cbx_show;
    private CheckBox cbx_save;
    private TextView tv_newUser;
    private TextView tv_lostUser;

    private SharedPreferences pref;
    private SharedPreferences.Editor editor;

    private CircleImageView circleImageView;


    //这个是onCreate事件 Activity初始化的时候会运行这个
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //这句代码的意思就是取消表头  看到没就是刚才那里
        //王奥写的是不是有一个表头 这句的意思就是去掉那个
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);
        //这就是两个方法
        initView();
        initEven();
    }

    /**
     * 功能实现
     */
    private void initEven() {
        //设置下划线
        tv_newUser.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
        tv_lostUser.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

        tv_newUser.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, WelComeActivity.class);
                intent.putExtra("data", "创建");
                startActivity(intent);
            }
        });
        tv_lostUser.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, WelComeActivity.class);
                intent.putExtra("data", "更改");
                startActivity(intent);
            }
        });


        //会自动生成  这是一个抽象方法的实现
        //这个也就是控件的点击事件  大部分控件都有  onClick就是点击的意思
        //按钮的点击事件
        btn_send.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //判断输入框是否为空  这个应该能看懂 JAVA差不多
                if (!ed_name.getText().toString().isEmpty() ||
                        !ed_pwd.getText().toString().isEmpty()) {

                    if (pref.getString(ed_name.getText().toString(), null) == null) {
                        TS("没有数据,请注册");
                        return;
                    }

                    //判断用户名密码
                    if (ed_pwd.getText().toString().equals(pref.getString(ed_name.getText().toString(), null))) {
                        if (cbx_save.isChecked()) {
                            editor.putBoolean("isSave", true);
                            editor.putString("saveName", ed_name.getText().toString());
                            editor.putString("savePwd", ed_pwd.getText().toString());
                            editor.commit();
                        } else {
                            editor.clear();
                            editor.putBoolean("isSave", false);
                            editor.commit();
                        }

                        //intent 就是用来跳转用的。 构造方法第一个写这个activity  第二个参数写跳转到哪个activity
                        Intent intent = new Intent(MainActivity.this, RegisteredActivity.class);
                        startActivity(intent);
                        finish();
                    } else {
                        TS("用户名密码错误");
                    }
                } else {
                    //这两个就是提示
                    TS("用户名密码不能为空!!!");
                }
                //取消光标
                CancelFocus();
            }
        });
        //复选框的选中事件
        //选中事件  button 是 click  这个是checked   专业术语叫监听器
        cbx_show.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override                                           //这个参数就是多选框的状态 会在这里呈现
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    //这个就是固定语句   英语开头能看懂就行  记住就行了
                    ed_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                } else {
                    ed_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
                }
                CancelFocus();
            }
        });


    }

    /**
     * 控件实例化
     * 和类的初始化一样
     * 上边只是定义出来了 我们需要把代码和界面连接起来
     * findViewByID 翻译一下通过寻找ID找控件
     * 这样就和界面连接起来了
     */
    @SuppressLint("CommitPrefEdits")
    private void initView() {
        tv_newUser = findViewById(R.id.tv_newUser);
        tv_lostUser = findViewById(R.id.tv_lostUser);
        btn_send = findViewById(R.id.btn_send);
        ed_name = findViewById(R.id.ed_Name);
        ed_pwd = findViewById(R.id.ed_Pwd);
        cbx_show = findViewById(R.id.cbx_show);
        cbx_save = findViewById(R.id.cbx_save);
        circleImageView = findViewById(R.id.img_tx);
        //创建一个对象
        pref = getSharedPreferences("data", Context.MODE_PRIVATE);
        //实例化
        editor = pref.edit();
        //读取数据


        boolean isSave = pref.getBoolean("isSave", false);
        if (isSave) {
            cbx_save.setChecked(true);
            ed_name.setText(pref.getString("saveName", null));
            ed_pwd.setText(pref.getString("savePwd", null));
            changeImage();
        }
    }

    private void changeImage() {
        String path = pref.getString("path", null);
        if (path != null) {
            Bitmap bitmap = BitmapFactory.decodeFile(pref.getString("path", null));
            //旋转图片
            bitmap = changPic(bitmap, path);
            circleImageView.setImageBitmap(bitmap);
        }
    }

    //这个是吐司。中文叫法就这样  固定写法 data就是需要显示的文字  这个选项就是显示时间的长短
    public void TS(String data) {
        Toast.makeText(MainActivity.this, data, Toast.LENGTH_SHORT).show();
        //.show()别忘加了 这个是现实
    }

    /**
     * 取消EditText的焦点
     */
    public void CancelFocus() {
        // 翻译一下就懂什么意思
        //还有哪么?
        //
        ed_name.clearFocus();
        ed_pwd.clearFocus();//取消焦点
    }

    //返回事件
    @Override
    protected void onRestart() {
        super.onRestart();
        changeImage();
    }
}

注册界面和更改界面是同一个界面,懒得写第二个了 复用吧,用到数据库的时候再改成两个界面 有的地方没有加注释,你们看看能不能看懂我在干嘛

public class WelComeActivity extends AppCompatActivity {

    private static final int WRITE_SDCARD_PERMISSION_REQUEST_CODE = 1;
    private static final int IMAGE_REQUEST_CODE = 2;
    private static String path;
    private CircleImageView img_pic;
    private TextView tv_show_show;
    private TextView tv_show_pwd;
    private TextView tv_show_pwd2;
    private TextView tv_log_tx;
    private EditText ed_Name;
    private EditText ed_pwd;
    private EditText ed_pwd2;
    private Button btn_ok;
    private RadioGroup rg;
    private RadioButton rb_name;
    private RadioButton rb_pwd;
    private Uri imageUri;
    private LinearLayout linear;
    private SharedPreferences pref;
    private SharedPreferences.Editor editor;
    private String createOrUpdata;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wel_come);
        /*
         * 先判断用户以前有没有对我们的应用程序允许过读写内存卡内容的权限,
         * 用户处理的结果在 onRequestPermissionResult 中进行处理
         */
        if (ContextCompat.checkSelfPermission(WelComeActivity.this,
                Manifest.permission.WRITE_EXTERNAL_STORAGE)
                != PackageManager.PERMISSION_GRANTED) {
            // 申请读写内存卡内容的权限
            ActivityCompat.requestPermissions(WelComeActivity.this,
                    new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
                    WRITE_SDCARD_PERMISSION_REQUEST_CODE);
        }
        initView();
        initEvent();
    }

    private void initView() {
        img_pic = findViewById(R.id.img_tx);
        tv_show_show = findViewById(R.id.tv_show_name);
        tv_show_pwd = findViewById(R.id.tv_show_pwd);
        tv_log_tx = findViewById(R.id.tv_log_tx);
        tv_show_pwd2 = findViewById(R.id.tv_show_pwd2);
        ed_Name = findViewById(R.id.ed_Name_change);
        ed_pwd = findViewById(R.id.ed_Pwd);
        ed_pwd2 = findViewById(R.id.ed_Pwd2);
        btn_ok = findViewById(R.id.btn_ok);
        rg = findViewById(R.id.rg_two);
        rb_name = findViewById(R.id.rb_name);
        rb_pwd = findViewById(R.id.rb_pwd);

        linear = findViewById(R.id.Linear01);

        pref = getSharedPreferences("data", Context.MODE_PRIVATE);
        //实例化
        editor = pref.edit();
        changeImage();
    }

    public void setShowName(String name, String pwd1, String pwd2) {
        tv_show_show.setText(name);
        ed_Name.setHint(name);
        tv_show_pwd.setText(pwd1);
        ed_pwd.setHint(pwd1);
        tv_show_pwd2.setText(pwd2);
        ed_pwd2.setHint(pwd2);
    }

    private void initEvent() {

        Intent intent = getIntent();
        createOrUpdata = intent.getStringExtra("data");
        if (createOrUpdata.equals("创建")) {
            rg.setVisibility(View.INVISIBLE);
            setShowName("请输入用户名", "输入密码", "确认密码");

        } else if (createOrUpdata.equals("更改")) {
            rg.setVisibility(View.VISIBLE);
            setShowName("请输入用户名", "输入旧密码", "输入新密码");

        }


        img_pic.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //在这里跳转到手机系统相册里面
                Intent intent = new Intent(
                        Intent.ACTION_PICK,
                        android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                startActivityForResult(intent, IMAGE_REQUEST_CODE);
                TS("穿越成功~~");
            }
        });
        //输入框的功能
        editLister();
        rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId) {
                    case R.id.rb_name:
                        //不修改头像
                        tv_log_tx.setVisibility(View.INVISIBLE);
                        img_pic.setVisibility(View.INVISIBLE);
                        break;
                    case R.id.rb_pwd:
                        //修改头像
                        tv_log_tx.setVisibility(View.VISIBLE);
                        img_pic.setVisibility(View.VISIBLE);
                        break;
                    default:
                        break;
                }
            }
        });
        //确定
        btn_ok.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!isNull()) {
                    if (createOrUpdata.equals("创建")) {
                        if (ed_pwd.getText().toString().equals(ed_pwd2.getText().toString())) {
                            editor.putString(ed_Name.getText().toString(),
                                    ed_pwd2.getText().toString());
                            editor.commit();
                            TS("创建成功,2秒后跳转");
                            intentTimeOf3();
                        } else {
                            TS("两次密码不相同");
                        }
                    } else if (createOrUpdata.equals("更改")) {
                        if (pref.getString(ed_Name.getText().toString(), null).equals(ed_pwd.getText().toString())) {
                            editor.putString(ed_Name.getText().toString(),
                                    ed_pwd2.getText().toString());
                            editor.commit();
                            TS("修改成功,2秒后跳转");
                            intentTimeOf3();
                        } else {
                            TS("更新失败");
                        }
                    }
                } else {
                    TS("数据不能为空");
                }
            }
        });

    }

    //延时跳转
    private void intentTimeOf3() {
        new Handler(new Handler.Callback() {
            @Override
            public boolean handleMessage(Message msg) {
                startActivity(new Intent(WelComeActivity.this, MainActivity.class));
                finish();
                return false;
            }
        }).sendEmptyMessageDelayed(0, 2000);
    }

    private boolean isNull() {
        //选中的是修改密码
        if (ed_Name.getText().toString().isEmpty() ||
                ed_pwd.getText().toString().isEmpty()
                || ed_pwd2.getText().toString().isEmpty()) {
            return true;
        }
        return false;
    }

//    private void rgChange(boolean isChangeName) {
//        if (isChangeName) {
//            tv_show_show.setText("请输入原用户名");
//            ed_Name.setHint("请输入原用户名");
//            tv_show_pwd.setText("请输入新用户名");
//            ed_pwd.setHint("请输入新用户名");
//            linear.setVisibility(View.GONE);
//        } else {
//            tv_show_show.setText("请输入用户名");
//            ed_Name.setHint("请输入用户名");
//            tv_show_pwd.setText("输入密码");
//            ed_pwd.setHint("输入密码");
//            linear.setVisibility(View.VISIBLE);
//        }
//
//    }

    //edittext监听
    private void editLister() {
        TextChange ed_Name_change = new TextChange(ed_Name, tv_show_show);
        ed_Name.addTextChangedListener(ed_Name_change);
        TextChange ed_pwd_change = new TextChange(ed_pwd, tv_show_pwd);
        ed_pwd.addTextChangedListener(ed_pwd_change);
        TextChange ed_pwd_change2 = new TextChange(ed_pwd2, tv_show_pwd2);
        ed_pwd2.addTextChangedListener(ed_pwd_change2);

    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        finish();
    }

    private void changeImage() {
        String path = pref.getString("path", null);
        if (path != null) {

            Bitmap bitmap = BitmapFactory.decodeFile(pref.getString("path", null));
            //旋转图片
            bitmap = changPic(bitmap, path);
            img_pic.setImageBitmap(bitmap);
        }
    }

    //返回从图库获取的图片信息
    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        //在相册里面选择好相片之后调回到现在的这个activity中
        switch (requestCode) {
            case IMAGE_REQUEST_CODE://这里的requestCode是我自己设置的,就是确定返回到那个Activity的标志
                if (resultCode == RESULT_OK) {//resultCode是setResult里面设置的code值
                    try {
                        Uri selectedImage = data.getData(); //获取系统返回的照片的Uri
                        String[] filePathColumn = {MediaStore.Images.Media.DATA};
                        Cursor cursor = getContentResolver().query(selectedImage,
                                filePathColumn, null, null, null);//从系统表中查询指定Uri对应的照片
                        cursor.moveToFirst();
                        int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
                        path = cursor.getString(columnIndex);  //获取照片路径
                        cursor.close();
                        Bitmap bitmap = BitmapFactory.decodeFile(path);
                        //旋转图片
                        bitmap = changPic(bitmap, path);
                        img_pic.setImageBitmap(bitmap);
                        //把图片路径存起来
                        editor.putString("path", path);
                        editor.commit();
                    } catch (Exception e) {
                        // TODO Auto-generatedcatch block
                        e.printStackTrace();
                    }
                }
                break;
        }
    }



    public void TS(String data) {
        Toast.makeText(WelComeActivity.this, data, Toast.LENGTH_SHORT).show();
        //.show()别忘加了 这个是现实
    }

}

注册界面,界面源码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="@drawable/beijing"
    android:focusable="true"

    android:focusableInTouchMode="true"
    android:orientation="vertical"

    tools:context=".WelComeActivity">


    <de.hdodenhof.circleimageview.CircleImageView
        android:id="@+id/img_tx"
        android:layout_width="130dp"
        android:layout_height="130dp"
        android:layout_gravity="center"
        android:layout_marginTop="66dp"
        android:src="@drawable/beijing02" />

    <TextView
        android:id="@+id/tv_log_tx"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginTop="5dp"
        android:text="点击图片更改" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="50dp"
            android:layout_marginRight="50dp"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_show_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="请输入用户名"
                android:textColor="#80000000"
                android:visibility="invisible" />

            <EditText
                android:id="@+id/ed_Name_change"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="请输入用户名"
                android:importantForAutofill="no"
                android:textSize="20sp"
                tools:ignore="HardcodedText,TextFields" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="50dp"
            android:layout_marginRight="50dp"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_show_pwd"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="输入密码"
                android:textColor="#80000000"
                android:visibility="invisible" />

            <EditText
                android:id="@+id/ed_Pwd"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="输入密码"
                android:importantForAutofill="no"
                android:inputType="textPassword"
                android:textSize="20sp"
                tools:ignore="HardcodedText,TextFields" />
        </LinearLayout>


        <LinearLayout
            android:id="@+id/Linear01"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="50dp"
            android:layout_marginRight="50dp"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_show_pwd2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="确认密码"
                android:textColor="#80000000"
                android:visibility="invisible" />

            <EditText
                android:id="@+id/ed_Pwd2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="确认密码"
                android:importantForAutofill="no"
                android:inputType="textPassword"
                android:textSize="20sp"
                tools:ignore="HardcodedText,TextFields" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="50dp"
            android:layout_marginTop="5dp"
            android:layout_marginRight="50dp"
            android:orientation="horizontal">

            <RadioGroup
                android:id="@+id/rg_two"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal">

                <RadioButton
                    android:id="@+id/rb_name"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="不修改头像" />

                <RadioButton
                    android:id="@+id/rb_pwd"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:checked="true"
                    android:text="修改头像" />

            </RadioGroup>
        </LinearLayout>
    </LinearLayout>

    <Button
        android:id="@+id/btn_ok"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginTop="18dp"
        android:text="确定" />


</LinearLayout>

登录界面源码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="@+id/rel_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/beijing"

    android:focusable="true"
    android:focusableInTouchMode="true"

    tools:context=".MainActivity">

    <!--  取消焦点  -->

    <de.hdodenhof.circleimageview.CircleImageView
        android:id="@+id/img_tx"
        android:layout_width="130dp"
        android:layout_height="130dp"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center"
        android:layout_marginTop="66dp"
        android:src="@drawable/beijing02" />


    <EditText
        android:id="@+id/ed_Name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/img_tx"
        android:layout_centerHorizontal="true"
        android:layout_marginLeft="50dp"
        android:layout_marginTop="50dp"
        android:layout_marginRight="50dp"
        android:hint="请输入用户名"
        android:importantForAutofill="no"
        android:textSize="20sp"
        tools:ignore="HardcodedText,TextFields" />

    <EditText
        android:id="@+id/ed_Pwd"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/ed_Name"
        android:layout_centerHorizontal="true"
        android:layout_marginLeft="50dp"
        android:layout_marginTop="40dp"
        android:layout_marginRight="50dp"
        android:hint="请输入密码"
        android:importantForAutofill="no"
        android:inputType="textPassword"
        android:textSize="20sp"
        tools:ignore="HardcodedText,TextFields" />

    <CheckBox
        android:id="@+id/cbx_show"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/ed_Pwd"
        android:layout_alignStart="@id/ed_Pwd"
        android:layout_marginTop="10dp"
        android:text="显示密码"
        tools:ignore="HardcodedText" />

    <TextView
        android:id="@+id/tv_newUser"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/cbx_show"
        android:layout_alignStart="@id/cbx_show"
        android:layout_marginTop="5dp"
        android:text="新用户"
        android:textColor="#C4027180"
        android:textSize="16dp" />

    <CheckBox
        android:id="@+id/cbx_save"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/ed_Pwd"
        android:layout_alignEnd="@id/ed_Pwd"
        android:layout_centerVertical="true"
        android:layout_marginTop="10dp"
        android:text="记住密码"
        tools:ignore="HardcodedText" />

    <TextView
        android:id="@+id/tv_lostUser"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/cbx_save"
        android:layout_alignStart="@id/cbx_save"
        android:layout_marginTop="5dp"
        android:text="忘记密码"
        android:textColor="#9C9C9C"
        android:textSize="16dp" />


    <!--        ID是不是一样-->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/cbx_show"
        android:layout_marginLeft="50dp"
        android:layout_marginTop="40dp"
        android:layout_marginRight="50dp"
        android:gravity="center">

        <Button
            android:id="@+id/btn_send"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="登录"
            android:textSize="16sp"
            tools:ignore="HardcodedText" />


    </LinearLayout>


</RelativeLayout>

我感觉这次项目有点乱 有不理解的地方或有任何不懂得私聊我
源码地址:https://github.com/ZhangYH666/demo01

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值