【发布时间】:2019-12-20 21:18:02
【问题描述】:
有没有办法在任何移动应用程序的底部添加页脚大小的图像?
【问题讨论】:
标签: android android-layout mobile mobile-application mobile-development
有没有办法在任何移动应用程序的底部添加页脚大小的图像?
【问题讨论】:
标签: android android-layout mobile mobile-application mobile-development
最好的方法是在活动底部添加一个布局集,同时让屏幕的其余部分可滚动。您可以通过执行以下操作来实现:
<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。同样可以添加标题。
【讨论】: