移动软件开发实验五

一、实验目标

1.模仿微信“发现”页创建列表布局;

2.学习使用Textview imageview、LinearLayout

二、实验步骤

1.逻辑梳理

页面上主要包含5组列表,每组列表包含1-2个列表项。

具体内容解释如下: • 列表组1:“朋友圈”单行列表项; • 列表组2:“扫一扫”和“摇一摇”两行列表项; • 列表组3:“看一看”和“搜一搜”两行列表项; • 列表组4:“购物”和“游戏”两行列表项; • 列表组5:“小程序”单行列表项。

2.代码实现

<?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:orientation="vertical"
android:background="#e5e5e5"
tools:context=".MainActivity">
<View
    android:layout_width="match_parent"
    android:layout_height="10dp">
​
</View>
<LinearLayout
    android:background="#fff"
    android:layout_width="match_parent"
    android:layout_height="60dp">
    <ImageView
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:background="@drawable/pengyouquan"
        android:layout_marginLeft="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:textSize="18dp"
        android:textColor="#333"
        android:textStyle="bold"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        android:text="朋友圈">
    </TextView>
    <ImageView
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:src="@drawable/right"
        android:layout_marginRight="15dp"
        android:layout_gravity="center_vertical">
​
    </ImageView>
</LinearLayout>
<View
    android:layout_width="match_parent"
    android:layout_height="20dp">
​
</View>
<LinearLayout
    android:background="#fff"
    android:layout_width="match_parent"
    android:layout_height="60dp">
    <ImageView
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:background="@drawable/saoyisao"
        android:layout_marginLeft="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:textSize="18dp"
        android:textColor="#333"
        android:textStyle="bold"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        android:text="扫一扫">
    </TextView>
    <ImageView
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:src="@drawable/right"
        android:layout_marginRight="15dp"
        android:layout_gravity="center_vertical">
​
    </ImageView>
</LinearLayout>
<View
    android:layout_width="match_parent"
    android:layout_height="2dp">
​
</View>
<LinearLayout
    android:background="#fff"
    android:layout_width="match_parent"
    android:layout_height="60dp">
    <ImageView
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:background="@drawable/yaoyiyao"
        android:layout_marginLeft="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:textSize="18dp"
        android:textColor="#333"
        android:textStyle="bold"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        android:text="摇一摇">
    </TextView>
    <ImageView
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:src="@drawable/right"
        android:layout_marginRight="15dp"
        android:layout_gravity="center_vertical">
​
    </ImageView>
</LinearLayout>
<View
    android:layout_width="match_parent"
    android:layout_height="20dp">
​
</View>
<LinearLayout
    android:background="#fff"
    android:layout_width="match_parent"
    android:layout_height="60dp">
    <ImageView
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:background="@drawable/kanyikan"
        android:layout_marginLeft="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:textSize="18dp"
        android:textColor="#333"
        android:textStyle="bold"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        android:text="看一看">
    </TextView>
    <ImageView
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:src="@drawable/right"
        android:layout_marginRight="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
</LinearLayout>
<View
    android:layout_width="match_parent"
    android:layout_height="2dp">
​
</View>
<LinearLayout
    android:background="#fff"
    android:layout_width="match_parent"
    android:layout_height="60dp">
    <ImageView
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:background="@drawable/souyisou"
        android:layout_marginLeft="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:textSize="18dp"
        android:textColor="#333"
        android:textStyle="bold"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        android:text="搜一搜">
    </TextView>
    <ImageView
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:src="@drawable/right"
        android:layout_marginRight="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
</LinearLayout>
<View
    android:layout_width="match_parent"
    android:layout_height="20dp">
​
</View>
<LinearLayout
    android:background="#fff"
    android:layout_width="match_parent"
    android:layout_height="60dp">
    <ImageView
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:background="@drawable/gouwu"
        android:layout_marginLeft="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:textSize="18dp"
        android:textColor="#333"
        android:textStyle="bold"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        android:text="购物">
    </TextView>
    <ImageView
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:src="@drawable/right"
        android:layout_marginRight="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
</LinearLayout>
<View
    android:layout_width="match_parent"
    android:layout_height="2dp">
​
</View>
<LinearLayout
    android:background="#fff"
    android:layout_width="match_parent"
    android:layout_height="60dp">
    <ImageView
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:background="@drawable/youxi"
        android:layout_marginLeft="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:textSize="18dp"
        android:textColor="#333"
        android:textStyle="bold"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        android:text="游戏">
    </TextView>
    <ImageView
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:src="@drawable/right"
        android:layout_marginRight="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
</LinearLayout>
<View
    android:layout_width="match_parent"
    android:layout_height="20dp">
</View>
<LinearLayout
    android:background="#fff"
    android:layout_width="match_parent"
    android:layout_height="60dp">
    <ImageView
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:background="@drawable/xiaochengxu"
        android:layout_marginLeft="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:textSize="18dp"
        android:textColor="#333"
        android:textStyle="bold"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        android:text="小程序">
    </TextView>
    <ImageView
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:src="@drawable/right"
        android:layout_marginRight="15dp"
        android:layout_gravity="center_vertical">
    </ImageView>
</LinearLayout>
</LinearLayout>
​

三、程序运行结果

四、问题总结与体会

本次实验主要安装java环境比较困难,代码没有什么问题。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值