jpact
jpact

Reputation: 1072

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

enter image description here

Upvotes: 0

Views: 375

Answers (1)

Farouk Touzi
Farouk Touzi

Reputation: 3456

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 :

enter image description here

Upvotes: 1

Related Questions