今天我要讲的是一个装备选择的小案例
主界面是这样的风格:
首先我们需要分析里面需要用到的东西,例如图片和一些控件,还有布局设置。
并且要提前整理好头绪。
一、第一步我们先设计一下主布局:
具体代码如下:
<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=