Android的小程序——装备选择

本文介绍了Android平台上的一个装备选择小案例,涉及界面设计、布局设置和代码实现。主要涵盖了主界面布局的设计,以及进度条的添加和信息传递。案例重点在于如何在不同界面间传递数据并更新界面元素。
摘要由CSDN通过智能技术生成

今天我要讲的是一个装备选择的小案例

主界面是这样的风格:

首先我们需要分析里面需要用到的东西,例如图片和一些控件,还有布局设置。

并且要提前整理好头绪。

一、第一步我们先设计一下主布局:

具体代码如下:

<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.dell.first.MainActivity">
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/body"/>
    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <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="生命力:"/>

            <ProgressBar
                style="?android:attr/progressBarStyleHorizontal"
                android:layout_width="0dp"
                android:layout_weight="3"
                android:layout_height="wrap_content"
                android:id="@+id/progressBar1" />
            <TextView
                android:id="@+id/tet1"
                android:layout_marginLeft="30dp"
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="80"/>
        </TableRow>
    </TableLayout>
    <TableLayout
        android:layout_width=
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值