【问题标题】:How can I add a footer-sized image to the bottom of any mobile application?如何将页脚大小的图像添加到任何移动应用程序的底部?
【发布时间】:2019-12-20 21:18:02
【问题描述】:

有没有办法在任何移动应用程序的底部添加页脚大小的图像?

【问题讨论】:

    标签: android android-layout mobile mobile-application mobile-development


    【解决方案1】:

    最好的方法是在活动底部添加一个布局集,同时让屏幕的其余部分可滚动。您可以通过执行以下操作来实现:

    <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="match_parent"
        tools:context=".MainActivity" >
    
        <ScrollView
            android:id="@+id/scrollablContent"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/footerView"
            android:layout_below="@+id/headerView" >
    
            <LinearLayout
                android:id="@+id/content"
                android:layout_width="match_parent"
                android:layout_height="match_parent" >
            </LinearLayout>
        </ScrollView>
    
        <LinearLayout
            android:id="@+id/footerView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true" >
            <ImageView
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:src="@drawable/image_name" /> 
        </LinearLayout>
    
    </RelativeLayout>
    

    如果您只想添加一个图像而除此之外什么都没有,您也可以删除底部的 LinearLayout。同样可以添加标题。

    【讨论】:

    • 非常感谢您的回答,但我的问题太不准确了。我的意思是现有的移动应用程序。我将创建一个新问题,对不起。
    猜你喜欢
    • 2021-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-15
    • 2011-06-21
    • 2020-02-07
    • 2013-03-13
    • 2013-11-05
    相关资源
    最近更新 更多