简体   繁体   English

Android-右侧屏幕按钮

[英]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. 我想要实现的是一个带有ListView和一个圆形Button的活动,它是从屏幕右侧“出现”的。 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 PS:应使用按钮将新项目添加到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 : 结果是:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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