为什么兴趣爱好一栏无法实现传输

为什么这样写就只有兴趣爱好一栏无法实现传输?应该如何修改

img

img



<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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:background="@drawable/register_bg"
    android:orientation="vertical"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        >
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="注册"
            android:textSize="50dp"
            android:textColor="#fff"
            android:gravity="center"
            android:background="@color/colorBg"

            />
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center"
            >
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_weight="1"
                >
                <ImageView
                    android:layout_marginTop="15dp"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:src="@drawable/qq_icon"
                    />
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="用QQ注册"
                    android:textColor="#fff"
                    android:textSize="20dp"
                    android:gravity="center"
                    />
            LinearLayout>
            <View style="@style/vLine"/>
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_weight="1"

                >
                <ImageView
                    android:layout_marginTop="15dp"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:src="@drawable/weixin_icon"
                    />
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="用微信注册"
                    android:textColor="#fff"
                    android:textSize="20dp"
                    android:gravity="center"
                    />
            LinearLayout>

        LinearLayout>
        <View style="@style/hLine"/>

        <LinearLayout
            android:padding="15dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center"
            >
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:src="@drawable/email_icon"
                />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="使用电子邮箱注册"
                android:textColor="#fff"
                android:textSize="20dp"
                android:gravity="center"
                />
        LinearLayout>
        <View style="@style/hLine"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="15dp"
            >
            <TextView
                style="@style/tv"
                android:text="名字"
                />
            <EditText
                android:id="@+id/name"
                style="@style/et"
                />
        LinearLayout>
        <View style="@style/hLine"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="15dp"
            >
            <TextView
                style="@style/tv"
                android:text="邮箱"
                />
            <EditText
                android:id="@+id/emile"
                style="@style/et"
                />
        LinearLayout>
        <View style="@style/hLine"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="15dp"
            >
            <TextView
                style="@style/tv"
                android:text="密码"

                />
            <EditText
                style="@style/et"
                android:inputType="textPassword"
                />
        LinearLayout>
        <View style="@style/hLine"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="15dp"
            >
            <TextView
                style="@style/tv"
                android:text="性别"
                />
            <RadioGroup
                android:id="@+id/sex"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginLeft="50dp"
                android:orientation="horizontal"
                >
                <RadioButton
                    android:id="@+id/boy"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="男"
                    android:textSize="20dp"
                    android:textColor="#fff"
                    />
                <RadioButton
                    android:id="@+id/girl"
                    android:layout_marginLeft="20dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="女"
                    android:textSize="20dp"
                    android:textColor="#fff"
                    />
            RadioGroup>
        LinearLayout>
        <View style="@style/hLine"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="15dp"
            >
            <TextView
                style="@style/tv"
                android:text="兴趣爱好"
                />
            <CheckBox
                android:id="@+id/sing"
                android:layout_marginLeft="15dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="唱歌"
                android:textSize="20dp"
                android:textColor="#fff"
                />
            <CheckBox
                android:id="@+id/dance"
                android:layout_marginLeft="15dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="跳舞"
                android:textSize="20dp"
                android:textColor="#fff"
                />
            <CheckBox
                android:id="@+id/read"
                android:layout_marginLeft="15dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="读书"
                android:textSize="20dp"
                android:textColor="#fff"
                />
        LinearLayout>
        <View style="@style/hLine"/>

    LinearLayout>

    <Button
        android:id="@+id/btn"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="@color/colorBt"
        android:text="提交"
        android:textColor="#fff"
        android:textSize="30dp"
        android:layout_alignParentBottom="true"
        android:paddingBottom="15dp"
        />
RelativeLayout>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/constraintlayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorPrimary"
    >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        >
        <TextView
            android:id="@+id/textView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="你的登录信息"
            android:gravity="center"
            android:textSize="40dp"
            android:textColor="#fff"
            />
        <View style="@style/hLine"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="15dp"
            >
            <TextView
                style="@style/tv"
                android:text="名字"
                />
            <EditText
                android:id="@+id/name_dialog"
                style="@style/et"
                />
        LinearLayout>
        <View style="@style/hLine"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="15dp"
            >
            <TextView
                style="@style/tv"
                android:text="邮箱"
                />
            <EditText
                android:id="@+id/emile_dialog"
                style="@style/et"
                />
        LinearLayout>
        <View style="@style/hLine"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="15dp"
            >
            <TextView
                style="@style/tv"
                android:text="性别"
                />
            <EditText
                android:id="@+id/sex_dialog"
                style="@style/et"
                />
        LinearLayout>
        <View style="@style/hLine"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="15dp"
            >
            <TextView
                style="@style/tv"
                android:text="兴趣爱好"
                />
            <EditText
                android:id="@+id/hobbit_dialog"
                style="@style/et"
                />
        LinearLayout>
        <View style="@style/hLine"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center"
            >
            <Button
                android:id="@+id/cancel"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="取消"
                android:textSize="20dp"
                android:background="@color/colorBt"
                android:textColor="#fff"
                />
            <Button
                android:id="@+id/ok"
                android:layout_marginLeft="40dp"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="登录"
                android:textSize="20dp"
                android:background="@color/colorBt"
                android:textColor="#fff"
                />
        LinearLayout>
    LinearLayout>


RelativeLayout>



```java
package com.example.myapplication;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioGroup;

public class MainActivity extends AppCompatActivity implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
    EditText name,emile;
    private String sexfinally;
    CheckBox sing,dance,read;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        name=this.findViewById(R.id.name);
        emile=this.findViewById(R.id.emile);
        sing=this.findViewById(R.id.sing);
        dance=this.findViewById(R.id.dance);
        read=this.findViewById(R.id.read);
        sing.setOnCheckedChangeListener(this);
        dance.setOnCheckedChangeListener(this);
        read.setOnCheckedChangeListener(this);

        RadioGroup sex=this.findViewById(R.id.sex);
        sex.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId) {
                    case R.id.boy:
                        sexfinally="男";
                        break;
                    case R.id.girl:
                        sexfinally="女";
                        break;
                }
            }
        });
        Button button=this.findViewById(R.id.btn);
        button.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
//        1.创建构造器
        AlertDialog.Builder builder=new AlertDialog.Builder(MainActivity.this);
//        2.获取对话框布局
        //三个参数,第一个上下文,第二个:设置的布局文件 第三个:给view指定容器
        View view_dialog=View.inflate(this,R.layout.layout_dialog,null);
//        3.设置对话框布局
        builder.setView(view_dialog);
//        4.创建对话框
        final AlertDialog dialog=builder.create();
//        5.设置取消,确定按钮
        EditText name_dialog=view_dialog.findViewById(R.id.name_dialog);
        EditText emile_dialog=view_dialog.findViewById(R.id.emile_dialog);
        EditText sex_dialog=view_dialog.findViewById(R.id.sex_dialog);

        String namest=name.getText().toString();
        String emilest=emile.getText().toString();
        name_dialog.setText(namest);
        emile_dialog.setText(emilest);
        sex_dialog.setText(sexfinally);


        Button btn_cannel=view_dialog.findViewById(R.id.cancel);
        btn_cannel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        Button btn_ok=view_dialog.findViewById(R.id.ok);
        btn_ok.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
                MainActivity.this.finish();
            }
        });
//        6.显示对话框
        dialog.show();


    }

    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        String hobbit;
        hobbit=new String();
        AlertDialog.Builder builder=new AlertDialog.Builder(MainActivity.this);
        View view_dialog=View.inflate(this,R.layout.layout_dialog,null);
        builder.setView(view_dialog);
        EditText hobbit_dialog=view_dialog.findViewById(R.id.hobbit_dialog);

        String change=buttonView.getText().toString();
        if(isChecked) {
            if(!hobbit.contains(change)) {
                hobbit=hobbit+change;
                System.out.println("*****************aaaaaaaaaaa**********"+hobbit);

            }

        } else {
            if (hobbit.contains(change)) {
                hobbit=hobbit.replace(change,"");
                System.out.println("*****************bbbbbbbb**********"+hobbit);
            }
        }
        hobbit_dialog.setText(hobbit);
        System.out.println("*****************ccccccc**********"+hobbit);
    }
}



很抱歉,您提供的代码片段不完整,无法确定问题出在哪里。但是,一般来说,如果只有兴趣爱好一栏无法实现传输,可能是以下原因之一:
1. 数据传输的代码有误:请检查数据传输的代码是否正确,是否正确获取了兴趣爱好的数据。
2. 布局文件的代码有误:请检查布局文件中兴趣爱好一栏的代码是否正确,是否正确设置了其对应的id。
3. 数据传输的方式有误:请检查数据传输的方式是否正确,是否使用了正确的传输方式。
如果您能提供更详细的代码片段和问题描述,我可以更准确地帮助您解决问题。不知道你这个问题是否已经解决, 如果还没有解决的话:
  • 你可以参考下这个问题的回答, 看看是否对你有帮助, 链接: https://ask.csdn.net/questions/713755
  • 我还给你找了一篇非常好的博客,你可以看看是否有帮助,链接:隐形守护者手游怎么用电脑玩 隐形守护者模拟器玩法教程
  • 除此之外, 这篇博客: 一步步实现这个炫酷的树状节点图自定义控件中的 实现树状图的回归适应屏幕 部分也许能够解决你的问题, 你可以仔细阅读以下内容或者直接跳转源博客中阅读:

    这个功能点相对简单,前提是TreeViewContainer放缩一定要以(0,0)为中心点,并且TreeViewContainer的移动放缩不是使用Canas或srollTo操作,这样在onSizeChange中,我们记录适配屏幕的scale就行了。

    /**
    *记录
    */
    @Override
        protected void onSizeChanged(int w, int h, int oldw, int oldh) {
            super.onSizeChanged(w, h, oldw, oldh);
            TreeViewLog.e(TAG,"onSizeChanged w["+w+"]h["+h+"]oldw["+oldw+"]oldh["+oldh+"]");
            viewWidth = w;
            viewHeight = h;
            drawInfo.setWindowWidth(w);
            drawInfo.setWindowHeight(h);
            fixWindow();
        }
        /**
         * fix view tree
         */
        private void fixWindow() {
            float scale;
            float hr = 1f*viewHeight/winHeight;
            float wr = 1f*viewWidth/winWidth;
            scale = Math.max(hr, wr);
            minScale = 1f/scale;
            if(Math.abs(scale-1)>0.01f){
                //setPivotX((winWidth*scale-viewWidth)/(2*(scale-1)));
                //setPivotY((winHeight*scale-viewHeight)/(2*(scale-1)));
                setPivotX(0);
                setPivotY(0);
                setScaleX(1f/scale);
                setScaleY(1f/scale);
            }
            //when first init
            if(centerMatrix==null){
                centerMatrix = new Matrix();
            }
            centerMatrix.set(getMatrix());
            float[] values = new float[9];
            centerMatrix.getValues(values);
            values[Matrix.MTRANS_X]=0f;
            values[Matrix.MTRANS_Y]=0f;
            centerMatrix.setValues(values);
            setTouchDelegate();
        }
    
    	/**
    	*恢复
    	*/
       public void focusMidLocation() {
            TreeViewLog.e(TAG, "focusMidLocation: "+getMatrix());
            float[] centerM = new float[9];
            if(centerMatrix==null){
                TreeViewLog.e(TAG, "no centerMatrix!!!");
                return;
            }
            centerMatrix.getValues(centerM);
            float[] now = new float[9];
            getMatrix().getValues(now);
            if(now[Matrix.MSCALE_X]>0&&now[Matrix.MSCALE_Y]>0){
                animate().scaleX(centerM[Matrix.MSCALE_X])
                        .translationX(centerM[Matrix.MTRANS_X])
                        .scaleY(centerM[Matrix.MSCALE_Y])
                        .translationY(centerM[Matrix.MTRANS_Y])
                        .setDuration(DEFAULT_FOCUS_DURATION)
                        .start();
            }
        }
    
    
  • 您还可以看一下 2017CCTC大会老师的【微服务专场】实施微服务架构的关键技术课程中的 实施微服务架构的关键技术小节, 巩固相关知识点

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^