【问题标题】:How to set footer in android如何在android中设置页脚
【发布时间】:2010-09-30 05:37:19
【问题描述】:

如何在每个页面的android中设置页脚

我用过:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
   android:background="@color/mcolor"
   android:layout_width="fill_parent" 
   android:layout_height="fill_parent" 
   android:layout_gravity="fill">

<ImageButton android:id="@+id/iconbtn" 
           android:layout_height="wrap_content" 
           android:src="@drawable/all_icon_138" 
           android:layout_marginRight="4px" 
           android:layout_gravity="fill" 
           android:clickable="true"
            android:layout_width="wrap_content" 
            android:background="@color/mcolor"
             android:layout_marginLeft="60px" 
             android:layout_marginTop="12px" android:saveEnabled="true">
</ImageButton>
<TextView android:text="@+id/TextView01" 
     android:id="@+id/label" 
     android:textColor="@color/mbcolor" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center"
     android:scrollbars="vertical" 
     android:layout_marginBottom="30px"
     android:layout_marginTop="30px" 
     android:textSize="12px"
     android:layout_marginRight="30px"
     android:layout_marginLeft="130px"></TextView>
<LinearLayout android:layout_marginTop="50dip" 
    android:gravity="bottom"
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent"
     android:layout_alignParentBottom="true">
     <ImageButton android:id="@+id/previous"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/newfox_footer_320"
            android:layout_alignParentBottom="true"
             android:layout_alignParentRight="false" 
              android:layout_alignParentLeft="false" android:layout_marginLeft="190px" android:layout_marginRight="2px">
            </ImageButton></LinearLayout>
</RelativeLayout>

在每个TextView 之后显示 6 个页脚图像。 如何设置?

【问题讨论】:

标签: android android-layout


【解决方案1】:

不清楚你到底想要什么,但我假设你想要一个布局中的页脚。

使用框架布局作为主要布局

width = fillparent
height = fillparent

采取另一个框架布局将重力设置为底部。 将视图添加到此框架布局。 这是你的页脚。

【讨论】:

    【解决方案2】:

    将您的 xml 布局的根视图设为 RelativeLayout。 然后,您想要作为页脚的视图或他的父级(根视图元素的直接子级:RelativeLayout)需要具有此属性: android:layout_alignParentBottom="true"

    【讨论】:

      【解决方案3】:

      您已使用 LinearLayout 作为页脚,因此您可以查看 stackoverflow: footer for linear layout in android

      【讨论】:

        猜你喜欢
        • 2012-03-11
        • 1970-01-01
        • 1970-01-01
        • 2019-04-12
        • 1970-01-01
        • 1970-01-01
        • 2021-06-27
        • 2012-01-02
        • 2014-08-10
        相关资源
        最近更新 更多