我想将按钮放在 ImageView 上方。
我该怎么做?
(请不要设置背景,因为我需要 ImageView)
最佳答案
设为背景!
开个玩笑...您需要的是将您的 View 放在 RelativeLayout
中。类似的东西会起作用:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:text="blah blah"/>
</RelativeLayout>
请注意像 layout_alignParentLeft
这样的参数的使用,它们用于将 View 定位到您想要的位置。
关于android - 如何在android中的其他 View 上添加覆盖 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3790511/