1.分析界面
由以上及部分组成,在一个大框架中使用几个小框架,再在小框架中插入图片,实现图片显现。
使用代码如下:
<?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:background="@drawable/index_bg"
android:orientation="vertical"
android:gravity="center_horizontal"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="360dp"
android:layout_height="30dp"
android:layout_marginTop="190dp"
android:layout_gravity="center"
android:alpha="0.8"
android:gravity="center">
<TextView
android:layout_width="180dp"
android:layout_height="30dp"
android:textColor="#000066"
android:text="部队管理"
android:layout_marginLeft="1dp"
android:gravity="center"
android:background="@color/white"
android:layout_gravity="left"/>
<TextView
android:layout_width="180dp"
android:layout_height="30dp"
android:background="@color/cardview_dark_background"
android:textColor="@color/white"
android:gravity="center"
android:text="灭火救援"
android:layout_gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="10dp"
android:layout_height="9dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="300dp"
android:background="@drawable/logo" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="10dp"
android:background="@drawable/list_bg">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/list_logo"
android:layout_marginRight="-100dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="10dp"
android:background="@drawable/list_bg2">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/list_logo2"
android:layout_marginRight="-100dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="10dp"
android:background="@drawable/list_bg3">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/list_logo3"
android:layout_marginRight="-100dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="10dp"
android:background="@drawable/list_bg4">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/list_logo4"
android:layout_marginRight="-100dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="10dp"
android:background="@drawable/list_bg5">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/list_logo5"
android:layout_marginRight="-100dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="405dp"
android:layout_height="40dp"
android:background="@color/white"
android:gravity="top"
android:layout_marginTop="50dp"
>
<LinearLayout
android:layout_width="135dp"
android:layout_height="20dp"
android:gravity="center"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/logo1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="首页"/>
</LinearLayout>
<LinearLayout
android:layout_width="135dp"
android:layout_height="20dp"
android:gravity="center"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/logo2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="消息"/>
</LinearLayout>
<LinearLayout
android:layout_width="135dp"
android:layout_height="20dp"
android:gravity="center"
>
<ImageView
android:layout_width="21dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:src="@drawable/logo3"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="个人中心"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
设计界面如下图
使用首页同样的样式,进行修改便可以。
在第一次出现的问题,还没有解决,在百度搜索不到该问题,根据运行错误的提示,寻找什么位置出问题,再去问同学相同位置下的配置是否一样,没有出现问题,便进行修改。