简体   繁体   中英

Android - right side screen button

I would like to ask you if it's possible to place a Button "above" another View. What I'm trying to achieve is an activity with ListView and a circle shape Button, which is "coming" from right side of screen. However, if somebody scroll down, button has to stay on it's position, and once he is pressed, new fragment is invoked. In fact, I got stucked at very beginning and have no idea how to do that, so every advice/hint/suggestion is welcome.

PS: Button should be used to add new item into ListView

Also, I've created a sketch for better explanation.

Thanks, Regards

在此处输入图片说明

I tried for you and it works fine.

<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"
android:background="#FFFFFF" >

<ListView
    android:id="@+id/listAlertItems"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:dividerHeight="1px"
    android:listSelector="@android:color/transparent" />

<ImageView
    android:id="@+id/clickBtn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerInParent="true"
    android:src="@drawable/ic_img" />

This is the result :

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM