我想设置一个带有菜单的页脚,我想根据屏幕设置图标等分

I want to set a footer with menu and I want to set icons equally divided as per the screen

这是我的 .xml 文件,我只想将所有图像视图设置为水平 每个屏幕...我试过了,但没有发生...帮我解决这个问题

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:gravity="center"
    tools:context="com.example.sachin.attendence.MainActivity">

首先我设置相对布局 和所有 imageview 作为菜单

   <ImageView
       android:id="@+id/imageViewFooter2"
       android:layout_width="60dp"
       android:layout_weight="1"
       android:layout_height="60dp"
       android:layout_marginLeft="100dp"
       android:background="@drawable/ic_launcher"
       android:layout_alignParentBottom="true"
        />

   <ImageView
       android:id="@+id/imageViewFooter3"
       android:layout_width="60dp"
       android:layout_height="60dp"
       android:layout_weight="1"
       android:background="@drawable/att"
       android:layout_marginLeft="150dp"
       android:layout_alignParentBottom="true"
        />

   <ImageView
       android:id="@+id/imageViewFooter4"
       android:layout_width="60dp"
       android:layout_height="60dp"
       android:layout_weight="1"
       android:scaleType="fitXY"
       android:layout_marginLeft="250dp"
       android:background="@drawable/omlogo"
       android:layout_alignParentBottom="true"
        />
    <View
       android:layout_width="match_parent"
       android:layout_height="01dp"
       android:background="#cec5ce"
       android:layout_above="@id/imageViewFooter3"
       android:id="@+id/view">

    </View>
    </RelativeLayout>

这是我的 .xml 文件

我假设您想在其他屏幕中重复使用您的页脚。在那种情况下,您真的应该为页脚创建不同的 XML 文件,并将其包含在内。

下面的例子footer.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:background="#bbb" 
    android:orientation="horizontal">

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/icon" />  <!-- your image here -->

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/icon" />

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/icon" /> 
</LinearLayout>

我创建了我在本示例中使用的简单可绘制对象 icon

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <size
        android:width="48dp"
        android:height="48dp" />
    <solid android:color="#757" /> <!-- your background-->
</shape>

要在任何屏幕中包含您的 footer.xml 文件,请使用 include 标签,如下所示:

<include
    layout="@layout/footer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true" />