android编程中怎么将一个按钮置于最上层

解决方案 »

  1.   

    可以使用FrameLayout,一层一层的往上面叠,最后添加按钮,那么这个按钮就被置于最上层了。
      

  2.   

    楼上说的FrameLayout不能自定义控件的位置。可以这样是先,你可以用相对布局RelativeLayout;然后给他一个id;然后再写那个按钮时把他相对的父控件式这个相对布局的id;下面是按钮总在最上层的右下角:
    <?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"
        android:id="@+id/webMainLayout"
       >    
        <Button 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/btnRegister"
            android:layout_alignBottom="@id/webMainLayout"
            android:layout_alignParentRight="true"
            android:layout_alignParentBottom="true"
            android:text="切换邮箱"
           
            />
    </RelativeLayout>
    希望对你有用。