Android案例 装备购买
2017-03-27 20:05
323 查看
一、运行效果图
二、相关代码
<?xml version="1.0"
encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.administrator.myapplication.MainActivity"
android:weightSum="1">
<ImageView
android:layout_width="87dp"
android:layout_height="108dp"
android:src="@drawable/timg"
android:layout_gravity="center"
android:layout_marginTop="60dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="主人快给我买装备吧"
android:layout_gravity="center_horizontal"
/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="25dp">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="生命值">
</TextView>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_marginLeft="20dp"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="40">
</TextView>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="攻击力">
</TextView>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_marginLeft="20dp"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="200">
</TextView>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="敏捷">
</TextView>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_marginLeft="20dp"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="40">
</TextView>
</TableRow>
</TableLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="主人购买装备"
android:onClick="click1"/>
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="小宝宝购买装备"
android:onClick="click2"/>
</LinearLayout>
</LinearLayout>
二、相关代码
<?xml version="1.0"
encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.administrator.myapplication.MainActivity"
android:weightSum="1">
<ImageView
android:layout_width="87dp"
android:layout_height="108dp"
android:src="@drawable/timg"
android:layout_gravity="center"
android:layout_marginTop="60dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="主人快给我买装备吧"
android:layout_gravity="center_horizontal"
/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="25dp">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="生命值">
</TextView>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_marginLeft="20dp"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="40">
</TextView>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="攻击力">
</TextView>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_marginLeft="20dp"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="200">
</TextView>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="敏捷">
</TextView>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_marginLeft="20dp"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="40">
</TextView>
</TableRow>
</TableLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="主人购买装备"
android:onClick="click1"/>
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="小宝宝购买装备"
android:onClick="click2"/>
</LinearLayout>
</LinearLayout>
相关文章推荐
- Activity中的数据传送—案例: 购买装备
- Android案例—装备选择
- Activity跳转,数据传递(购买装备案例)
- Android两个android两个activity之间相互传递数据之装备选择(书上案例)
- Android:实现装备购买
- Android装备选择案例
- Android 案例—装备选择
- 实验:Android案例——小宝宝装备选择
- Android---装备选择(案例)
- 关于android的装备选择案例
- Android:实现装备购买
- Android装备选择案例
- Android装备选择案例,演示Activity回传数据
- Android之装备选择案例
- android购买装备
- Android装备选择案例
- Android中Activity的跳转与数据的传递案例(装备的选择)
- Android实现模拟装备购买
- Android逆向之滑雪大冒险无限装备购买
- Android开发案例——装备选择