Android:实现装备购买

大概步骤建立几个Activity并将图片分别关联到其中,并进行布局操作,一个是主要的界面,另一个是进入Shop后的界面,操作的具体代码和结果如下:

代码:

activity_char.xml

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:orientation="vertical" android:layout_width="match_parent"  
  4.     android:layout_height="match_parent">  
  5.     <TextView  
  6.         android:id="@+id/name"  
  7.         android:layout_width="wrap_content"  
  8.         android:layout_height="wrap_content"  
  9.         android:layout_marginLeft="10dp"  
  10.         />  
  11. <ImageView  
  12.     android:id="@+id/iv"  
  13.     android:layout_width="120dp"  
  14.     android:layout_height="150dp"  
  15.     android:layout_gravity="center"  
  16.     android:layout_marginTop="50dp"  
  17.     android:background="@drawable/soldier76"/>  
  18.     <TextView  
  19.         android:id="@+id/CN"  
  20.         android:layout_width="wrap_content"  
  21.         android:layout_height="wrap_content"  
  22.         android:layout_gravity="center"  
  23.         android:layout_marginTop="5dp"  
  24.         android:textSize="23sp"  
  25.         android:text="Soldier76"  
  26.         />  
  27.     <TextView  
  28.         android:id="@+id/status"  
  29.         android:layout_width="wrap_content"  
  30.         android:layout_height="wrap_content"  
  31.         android:layout_gravity="center"  
  32.         android:layout_marginTop="5dp"  
  33.         android:layout_marginBottom="3dp"  
  34.         android:text="Wonderful"  
  35.         android:textColor="#7CFC00"/>  
  36.     <TableLayout  
  37.         android:layout_width="match_parent"  
  38.         android:layout_height="wrap_content"  
  39.         android:layout_gravity="center">  
  40.         <TableRow  
  41.             android:layout_width="match_parent"  
  42.             android:layout_height="wrap_content">  
  43.             <TextView  
  44.                 android:layout_width="wrap_content"  
  45.                 android:layout_height="wrap_content"  
  46.                 android:text="Health"  
  47.                 android:textSize="20sp"  
  48.                 android:layout_weight="1"  
  49.                 />  
  50.             <ProgressBar  
  51.                 android:id="@+id/pro_health"  
  52.                 style="@style/Widget.AppCompat.ProgressBar.Horizontal"  
  53.                 android:layout_weight="2"  
  54.                 android:indeterminateTint="#7CFC00"  
  55.                 android:indeterminateTintMode="src_atop"/>  
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值