RPG角色生成器

来源:互联网 发布:网络管理的创新和发展 编辑:程序博客网 时间:2024/04/27 12:04

1.功能描述
几乎所有的RPG游戏在进入游戏时都会让用户自己来创建自己喜欢的角色。本次上机要求编写一个简化的创建游戏角色的程序。
2.游戏角色应有的属性
本题目要求的游戏角色应有以下属性:名字、性别、种族、职业、力量、敏捷、体力、智力、智慧、生命值和魔法值。
名字:不超过50个字符。
性别:可以选择男性和女性。
种族:一共可选五个种族,人类、精灵、兽人、矮人和元素。
职业:可选六种职业,狂战士、圣骑士、刺客、猎手、祭司和巫师。
其余属性均为整数。
本题目要求首先用户输入角色姓名,然后由用户选择角色性别,然后由用户选择种族,然后选择职业,然后自动分配力量、敏捷、体力、智力和智慧属性,并计算生命值和魔法值。
生命值=体力*20。
魔法值=(智力+智慧)*10。
3.职业限制
很多职业会限制某些种族选择,例如兽人不能就职圣骑士等等,种族和职业的限制表如下:
种族/职业 狂战士 圣骑士 刺客 猎手 祭司 巫师
人类 允许 允许 允许 允许 允许 允许
精灵 不允许 不允许 允许 允许 允许 允许
兽人 允许 不允许 不允许 允许 允许 不允许
矮人 允许 允许 不允许 不允许 允许 不允许
元素 不允许 不允许 不允许 不允许 允许 允许
所以在要求用户选择职业时,输出信息里面只能有用户所选择种族可以就职的职业。
4.初始属性
本题目要求力量、敏捷、体力、智力和智慧要求是随机值(利用随机数函数来取得随机数),但是五项属性的总和应该是100,并且应该和职业相关。例如狂战士的体力和力量就要比较高,而巫师需要较高的智力,而祭司则需要较高的智慧。各职业初始属性的大致比例应遵从下表:
职业/属性 力量 敏捷 体力 智力 智慧
狂战士 40 20 30 5 5
圣骑士 25 15 30 20 10
刺客 20 35 20 15 10
猎手 15 40 15 10 20
祭司 15 20 15 35 15
巫师 10 20 10 20 40
例如,前面示意图中的祭司的初始属性,大致满足该比例,但是应该是随机的。
然后利用属性值计算生命值和魔法值。
5.显示信息
最后向用户显示该角色的所有信息,然后询问用户是否满意,如用户不满意则重新创建,若用户满意则程序结束,并将用户创建角色的相关信息写入文件保存。

一.设计的成果(图片显示)
app图标
主页
这里写图片描述
这里写图片描述
这里写图片描述
二.代码显示

package com.example.computer.rpg;import android.content.Intent;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.view.View;import android.widget.AdapterView;import android.widget.ArrayAdapter;import android.widget.Button;import android.widget.EditText;import android.widget.ListView;import android.widget.TextView;import android.widget.Toast;import java.io.BufferedReader;import java.util.ArrayList;import java.util.List;public class People extends AppCompatActivity implements View.OnClickListener {    private List<Occptiion> occcptions=new ArrayList<>();    private List<Sex> sex = new ArrayList<>();    private List<Zhongzu> zh = new ArrayList<>();    private TextView edit_occption;    private TextView edit_sex;    private TextView edit_zhongzu;    private Button queren;    private EditText p_name;    private boolean processFlag = true; //默认可以点击    private ClickSleep cl = new ClickSleep();//防止同时点击多次    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_people);        edit_occption = (TextView)findViewById(R.id.p_occption);        edit_sex = (TextView)findViewById(R.id.p_sex);        edit_zhongzu= (TextView)findViewById(R.id.p_zhongzu);        queren = (Button) findViewById(R.id.queren);        p_name = (EditText)findViewById(R.id.p_name);        edit_occption.setOnClickListener(new View.OnClickListener() {            @Override            public void onClick(View v) {                if (edit_zhongzu.getText().toString().equals("")){                }else{                    if(!cl.isRuning()) {                        if (edit_zhongzu.getText().toString().equals("人类")){                            initOccptions6();                        }else if (edit_zhongzu.getText().toString().equals("精灵")){                            initOccptions5();                        }else if (edit_zhongzu.getText().toString().equals("兽人")){                            initOccptions4();                        }else if (edit_zhongzu.getText().toString().equals("矮人")){                            initOccptions3();                        }else if (edit_zhongzu.getText().toString().equals("元素")){                            initOccptions2();                        }                        OccptionAdapter adapter =  new OccptionAdapter(People.this,                                R.layout.occption_layout,occcptions);                        ListView listview = (ListView) findViewById(R.id.list_occption);                        listview.setAdapter(adapter);                        listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {                            @Override                            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {                                Occptiion occption = occcptions.get(position);                                edit_occption.setText(occption.getName());                            }                        });                        listview.invalidate();                        cl.runWithTime(ClickSleep.DEFAULT_SLEEP_TIME);                    }                }            }        });        edit_sex.setOnClickListener(new View.OnClickListener() {            @Override            public void onClick(View v) {                if(!cl.isRuning()) {                    initSexs();                    SexAdapter adapter =  new SexAdapter(People.this,                            R.layout.occption_layout,sex);                    ListView listview = (ListView) findViewById(R.id.list_occption);                    listview.setAdapter(adapter);                    listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {                        @Override                        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {                            Sex sexs = sex.get(position);                            edit_sex.setText(sexs.getSex());                        }                    });                    cl.runWithTime(ClickSleep.DEFAULT_SLEEP_TIME);                }            }        });        edit_zhongzu.setOnClickListener(new View.OnClickListener() {            @Override            public void onClick(View v) {                if(!cl.isRuning()) {                    if (processFlag) {                        initZhongzu();                        ZhongzuAdapter adapter =  new ZhongzuAdapter(People.this,                                R.layout.occption_layout,zh);                        ListView listview = (ListView) findViewById(R.id.list_occption);                        listview.setAdapter(adapter);                        listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {                            @Override                            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {                                Zhongzu zhu=zh.get(position);                                edit_zhongzu.setText(zhu.getName());                            }                        });                    }                cl.runWithTime(ClickSleep.DEFAULT_SLEEP_TIME);            }        }        });        p_name.setOnClickListener(new View.OnClickListener() {            @Override            public void onClick(View v) {                 p_name.getText().toString();            }        });        queren.setOnClickListener(new View.OnClickListener() {            @Override            public void onClick(View v) {                String s = p_name.getText().toString();                if((s.length())==0||edit_sex.getText().length()==0||edit_zhongzu.getText().length()==0                        ||edit_occption.getText().length()==0){                    Toast.makeText(People.this,"请输入完整信息",Toast.LENGTH_SHORT).show();                }                else{                    String s1 = p_name.getText().toString();                    String s2 = edit_occption.getText().toString();                    Intent intent = new Intent(People.this,View_activity.class);                    intent.putExtra("p_name", s1);//将s1的值给了p_name,并向下个活动传送值                    intent.putExtra("position",s2);                    startActivity(intent);                    People.this.finish();                }            }        });    }    private void initSexs(){        Sex girl = new Sex("女");        sex.add(girl);        Sex boy = new Sex("男");        sex.add(boy);    }    private void initZhongzu(){        Zhongzu person = new Zhongzu("人类");        zh.add(person);        Zhongzu jingling = new Zhongzu("精灵");        zh.add(jingling);        Zhongzu shouren = new Zhongzu("兽人");        zh.add(shouren);        Zhongzu airen = new Zhongzu("矮人");        zh.add(airen);        Zhongzu yuansu = new Zhongzu("元素");        zh.add(yuansu);    }    private void initOccptions6() {        Occptiion Kuang = new Occptiion("狂战士",R.drawable.kuang);        occcptions.add(Kuang);        Occptiion Wu = new Occptiion("巫师",R.drawable.wushi);        occcptions.add(Wu);        Occptiion Cike = new Occptiion("刺客",R.drawable.cike);        occcptions.add(Cike);        Occptiion Sheng = new Occptiion("圣骑士",R.drawable.sheng);        occcptions.add(Sheng);        Occptiion Lieshou = new Occptiion("猎手",R.drawable.lieshou);        occcptions.add(Lieshou);        Occptiion Jisi = new Occptiion("大祭司",R.drawable.jisi);        occcptions.add(Jisi);    }    private void initOccptions5() {        Occptiion Wu = new Occptiion("巫师",R.drawable.wushi);        occcptions.add(Wu);        Occptiion Cike = new Occptiion("刺客",R.drawable.cike);        occcptions.add(Cike);        Occptiion Lieshou = new Occptiion("猎手",R.drawable.lieshou);        occcptions.add(Lieshou);        Occptiion Jisi = new Occptiion("大祭司",R.drawable.jisi);        occcptions.add(Jisi);    }    private void initOccptions4() {        Occptiion Kuang = new Occptiion("狂战士",R.drawable.kuang);        occcptions.add(Kuang);        Occptiion Lieshou = new Occptiion("猎手",R.drawable.lieshou);        occcptions.add(Lieshou);        Occptiion Jisi = new Occptiion("大祭司",R.drawable.jisi);        occcptions.add(Jisi);    }    private void initOccptions3() {        Occptiion Kuang = new Occptiion("狂战士",R.drawable.kuang);        occcptions.add(Kuang);        Occptiion Sheng = new Occptiion("圣骑士",R.drawable.sheng);        occcptions.add(Sheng);        Occptiion Jisi = new Occptiion("大祭司",R.drawable.jisi);        occcptions.add(Jisi);    }    private void initOccptions2() {        Occptiion Wu = new Occptiion("巫师",R.drawable.wushi);        occcptions.add(Wu);        Occptiion Jisi = new Occptiion("大祭司",R.drawable.jisi);        occcptions.add(Jisi);    }    @Override    public void onClick(View v) {    }}
package com.example.computer.rpg;/** * Created by 鹏COMPUTER on 2017/5/10. */public class ClickSleep {    public static final long DEFAULT_SLEEP_TIME = 2000;    private boolean isRuning = false;    public boolean isRuning() {        return isRuning;    }    public void runWithTime(final long defaultSleepTime) {        isRuning = true;        new Thread() {            @Override            public void run() {                try {                    sleep(defaultSleepTime, 0);                } catch (InterruptedException e) {                    e.printStackTrace();                }                isRuning = false;                super.run();            }        }.start();    }}
package com.example.computer.rpg;import android.content.Intent;import android.graphics.Bitmap;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.view.View;import android.widget.Button;import android.widget.ImageView;public class MainActivity extends AppCompatActivity {    private Button enter;    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        enter = (Button)findViewById(R.id.enter);        enter.setOnClickListener(new View.OnClickListener() {            @Override            public void onClick(View v) {                Intent intent = new Intent(MainActivity.this,People.class);                startActivity(intent);            }        });    }}
package com.example.computer.rpg;/** * Created by 鹏COMPUTER on 2017/4/22. */public class Name{    private String name;    public Name(String name){        this.name= name;    }    public String getName(){        return name;    }}
import android.widget.ImageView;/** * Created by 鹏COMPUTER on 2017/4/17. */public class Occptiion {    private String name;    private int imageId;    public Occptiion(String name,int imageId){        this.name= name;        this.imageId= imageId;    }    public int getImageId(){        return imageId;    }    public String getName(){        return name;    }}
package com.example.computer.rpg;/** * Created by 鹏COMPUTER on 2017/4/17. */public class Sex {    private String sex;    public Sex(String sex){        this.sex= sex;    }    public String getSex(){        return sex;    }}
package com.example.computer.rpg;import android.content.Context;import android.support.annotation.LayoutRes;import android.support.annotation.NonNull;import android.support.annotation.Nullable;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.ArrayAdapter;import android.widget.ImageView;import android.widget.TextView;import java.util.List;/** * Created by 鹏COMPUTER on 2017/4/18. */public class SexAdapter extends ArrayAdapter<Sex> {    private int resourceId;    public SexAdapter(@NonNull Context context, @LayoutRes int resource,                           @NonNull List<Sex> objects) {        super(context, resource, objects);        resourceId = resource;    }    @NonNull    @Override    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {        Sex sex = getItem(position);        View view;        //提升运行速度        if (convertView==null){            view = LayoutInflater.from(getContext()).inflate(resourceId,parent,false);        }        else {            view = convertView;        }        TextView textView = (TextView)view.findViewById(R.id.mingcheng);        textView.setText(sex.getSex());        return view;    }}
package com.example.computer.rpg;/** * Created by 鹏COMPUTER on 2017/4/17. */public class Zhongzu {    private String name;    public Zhongzu(String name){        this.name= name;    }    public String getName(){        return name;    }}
package com.example.computer.rpg;import android.content.Context;import android.support.annotation.LayoutRes;import android.support.annotation.NonNull;import android.support.annotation.Nullable;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.ArrayAdapter;import android.widget.TextView;import java.util.List;/** * Created by 鹏COMPUTER on 2017/4/18. */public class ZhongzuAdapter extends ArrayAdapter<Zhongzu> {    private int resourceId;    public ZhongzuAdapter(@NonNull Context context, @LayoutRes int resource,                      @NonNull List<Zhongzu> objects) {        super(context, resource, objects);        resourceId = resource;    }    @NonNull    @Override    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {        Zhongzu zhongzu = getItem(position);        View view;        //提升运行速度        if (convertView==null){            view = LayoutInflater.from(getContext()).inflate(resourceId,parent,false);        }        else {            view = convertView;        }        TextView textView = (TextView)view.findViewById(R.id.mingcheng);        textView.setText(zhongzu.getName());        return view;    }}
import android.content.Context;import android.support.annotation.LayoutRes;import android.support.annotation.NonNull;import android.support.annotation.Nullable;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.ArrayAdapter;import android.widget.ImageView;import android.widget.TextView;import java.util.List;/** * Created by 鹏COMPUTER on 2017/4/17. */public class OccptionAdapter extends ArrayAdapter<Occptiion>{    private int resourceId;    public OccptionAdapter(@NonNull Context context, @LayoutRes int resource,                           @NonNull List<Occptiion> objects) {        super(context, resource, objects);        resourceId = resource;    }    @NonNull    @Override    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {        Occptiion option = getItem(position);        View view;        //提升运行速度        if (convertView==null){            view = LayoutInflater.from(getContext()).inflate(resourceId,parent,false);        }        else {            view = convertView;        }        ImageView optionImage = (ImageView)view.findViewById(R.id.occption_image);        TextView textView = (TextView)view.findViewById(R.id.mingcheng);        optionImage.setImageResource(option.getImageId());        textView.setText(option.getName());        return view;    }}
import android.content.DialogInterface;import android.content.Intent;import android.support.v7.app.AlertDialog;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.view.View;import android.widget.Button;import android.widget.EditText;import java.util.Random;import android.widget.TextView;import java.util.Random;public class View_activity extends AppCompatActivity {    private TextView ni1;    private TextView zhiye;    private TextView power;    private TextView minjie;    private TextView tili;    private TextView zhili;    private TextView zhihui;    private TextView life_aaccount;    private TextView magic;    private Button exitsys;    private String s1;    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.view_activity);        ni1 = (TextView)findViewById(R.id.ni1);        zhiye = (TextView)findViewById(R.id.zhiye);        power = (TextView)findViewById(R.id.power);        minjie = (TextView)findViewById(R.id.minjie);        zhili = (TextView)findViewById(R.id.zhili);        zhihui = (TextView)findViewById(R.id.zhihui);        tili = (TextView)findViewById(R.id.tili);        life_aaccount=(TextView)findViewById(R.id.life_account);        magic = (TextView)findViewById(R.id.magiic);        exitsys = (Button)findViewById(R.id.exitsys);        //接收上个活动传送的值        Intent intent =getIntent();        String first = intent.getStringExtra("p_name");        String two = intent.getStringExtra("position");        ni1.setText(first);        zhiye.setText(two);        int temp = 0;        if(two.equals("狂战士")) temp=1;        else if (two.equals("圣骑士"))   temp=2;        else if (two.equals("刺客"))   temp=3;        else if (two.equals("猎手"))   temp=4;        else if (two.equals("大祭司"))   temp=5;        else if (two.equals("巫师"))   temp=6;        if(temp>0){            switch (temp){                case 1:power.setText("40");                    minjie.setText("20");                    tili.setText("30");                    zhili.setText("5");                    zhihui.setText("5");                    life_aaccount.setText("600");                    magic.setText("100");                    break;                case 2:power.setText("25");                    minjie.setText("15");                    tili.setText("30");                    zhili.setText("20");                    zhihui.setText("10");                    life_aaccount.setText("600");                    magic.setText("300");                    break;                case 3:power.setText("20");                    minjie.setText("35");                    tili.setText("20");                    zhili.setText("15");                    zhihui.setText("10");                    life_aaccount.setText("400");                    magic.setText("250");                    break;                case 4:power.setText("15");                    minjie.setText("40");                    tili.setText("15");                    zhili.setText("10");                    zhihui.setText("20");                    life_aaccount.setText("300");                    magic.setText("300");                    break;                case 5:power.setText("15");                    minjie.setText("20");                    tili.setText("15");                    zhili.setText("35");                    zhihui.setText("15");                    life_aaccount.setText("300");                    magic.setText("500");                    break;                case 6:power.setText("10");                    minjie.setText("20");                    tili.setText("10");                    zhili.setText("20");                    zhihui.setText("40");                    life_aaccount.setText("200");                    magic.setText("600");                    break;                default:                    break;            }        }        exitsys.setOnClickListener(new View.OnClickListener() {            @Override            public void onClick(View v) {                Intent intent = new Intent(View_activity.this,MainActivity.class);                startActivity(intent);                View_activity.this.finish();            }        });    }}

主界面布局

<?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"    android:orientation="vertical"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:background="@drawable/plm">    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:orientation="vertical"        >        <TextView            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:layout_margin="2dp"            android:background="#ffff00"            android:text="欢迎进入梦幻世界"            android:layout_gravity="center"            android:textSize="42dp"            android:textColor="#ff00ff"/>        <Button            android:id="@+id/enter"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_gravity="center"            android:text="开始征途"/>        </LinearLayout>></LinearLayout>
<?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"    android:orientation="vertical"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:background="@drawable/timg"    android:splitMotionEvents="false"    android:baselineAligned="false">    <LinearLayout        android:orientation="horizontal"        android:layout_width="match_parent"        android:layout_height="45dp">        <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:textSize="18sp"            android:hint="不超过50个字符"            android:maxLength="50"            android:layout_weight="2"            android:text="角色名称"            />        <EditText            android:id="@+id/p_name"            android:layout_height="wrap_content"            android:layout_width="0dp"            android:textColor="#000"            android:layout_weight="4"            />    </LinearLayout>    <LinearLayout        android:orientation="horizontal"        android:layout_width="match_parent"        android:layout_height="45dp">        <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:textSize="18sp"            android:layout_weight="2"            android:text="性别"            />        <TextView            android:id="@+id/p_sex"            android:layout_height="wrap_content"            android:layout_width="0dp"            android:textColor="#000"            android:hint="点击选择性别"            android:layout_weight="4"            />    </LinearLayout>    <LinearLayout        android:orientation="horizontal"        android:layout_width="match_parent"        android:layout_height="45dp">        <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:textSize="18sp"            android:layout_weight="2"            android:text="种族"            />        <TextView            android:id="@+id/p_zhongzu"            android:layout_height="wrap_content"            android:layout_width="0dp"            android:textColor="#000"            android:hint="点击选择种族"            android:layout_weight="4"            />    </LinearLayout>    <LinearLayout        android:orientation="horizontal"        android:layout_width="match_parent"        android:layout_height="45dp">        <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:textSize="18sp"            android:layout_weight="2"            android:text="职业"            />        <TextView            android:id="@+id/p_occption"            android:layout_height="wrap_content"            android:layout_width="0dp"            android:textColor="#000"            android:hint="点击选择职业"            android:layout_weight="4"            />    </LinearLayout>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:orientation="horizontal"        android:layout_gravity="bottom">        <Button            android:id="@+id/queren"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:text="确定"/>    </LinearLayout>    <ListView        android:id="@+id/list_occption"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:cacheColorHint="@color/colorPrimary">    </ListView>    <!--<ImageView-->        <!--android:layout_width="80dp"-->        <!--android:layout_height="80dp"-->        <!--android:id="@+id/occption_image"/>-->    <!--<TextView-->        <!--android:id="@+id/mingcheng"-->        <!--android:layout_width="wrap_content"-->        <!--android:layout_height="wrap_content"-->        <!--android:layout_gravity="center_vertical"-->        <!--android:layout_marginLeft="10dp"/>--></LinearLayout>
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:background="@color/colorPrimary">    <ImageView        android:layout_width="80dp"        android:layout_height="80dp"        android:id="@+id/occption_image"/>    <TextView        android:id="@+id/mingcheng"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_gravity="center_vertical"        android:textColor="#fff"        android:layout_marginLeft="10dp"/></LinearLayout>
<?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/lit"    android:orientation="vertical">    <LinearLayout        android:layout_width="match_parent"        android:layout_height="50dp"        android:orientation="horizontal">        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:textColor="#ff00ff"            android:textSize="40dp"            android:text="呢称"/>        <TextView            android:id="@+id/ni1"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:textSize="40dp"            android:textColor="#ff00ff"            android:layout_weight="3" />    </LinearLayout>>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="50dp"        android:orientation="horizontal">        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:textColor="#ff00ff"            android:textSize="40dp"            android:text="职业"/>        <TextView            android:id="@+id/zhiye"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:textColor="#ff00ff"            android:textSize="40dp"            android:layout_weight="3" />    </LinearLayout>>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="50dp"        android:orientation="horizontal">        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:textColor="#ff00ff"            android:textSize="40dp"            android:text="力量"/>        <TextView            android:id="@+id/power"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:textSize="40dp"            android:textColor="#ff00ff"            android:layout_weight="3" />    </LinearLayout>>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="50dp"        android:orientation="horizontal">        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:textColor="#ff00ff"            android:textSize="40dp"            android:text="敏捷"/>        <TextView            android:id="@+id/minjie"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:textColor="#ff00ff"            android:textSize="40dp"            android:layout_weight="3" />    </LinearLayout>>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="50dp"        android:orientation="horizontal">        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:textColor="#ff00ff"            android:textSize="40dp"            android:text="体力"/>        <TextView            android:id="@+id/tili"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:textSize="40dp"            android:textColor="#ff00ff"            android:layout_weight="3" />    </LinearLayout>>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="50dp"        android:orientation="horizontal">        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:textColor="#ff00ff"            android:textSize="40dp"            android:text="智力"/>        <TextView            android:id="@+id/zhili"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:textColor="#ff00ff"            android:textSize="40dp"            android:layout_weight="3" />    </LinearLayout>>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="50dp"        android:orientation="horizontal">        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:textColor="#ff00ff"            android:textSize="40dp"            android:text="智慧"/>        <TextView            android:id="@+id/zhihui"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:textColor="#ff00ff"            android:textSize="40dp"            android:layout_weight="3" />    </LinearLayout>>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="50dp"        android:orientation="horizontal">        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:textColor="#ff00ff"            android:textSize="40dp"            android:text="生命值"/>        <TextView            android:id="@+id/life_account"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:textColor="#ff00ff"            android:textSize="40dp"            android:layout_weight="3" />    </LinearLayout>>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="50dp"        android:orientation="horizontal">        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:textColor="#ff00ff"            android:textSize="40dp"            android:text="魔力"/>        <TextView            android:id="@+id/magiic"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:textColor="#ff00ff"            android:textSize="40dp"            android:layout_weight="3" />    </LinearLayout>>    <Button        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:gravity="center"        android:text="退出"        android:id="@+id/exitsys" /></LinearLayout>

博主初次写android程序,所以不是很精美,只能说是刚能完成要求而已,希望大家可以多多包涵。

0 0
原创粉丝点击