0

我想问你是否有可能在另一个视图上方放置按钮。我想要实现的是带有ListView和圆形按钮的活动,该按钮从屏幕右侧“进入”。但是,如果有人向下滚动,则按钮必须保持在其位置上,并且一旦按下,就会调用新的片段。事实上,我一开始就陷入困境,不知道该怎么做,所以每一条建议/暗示/建议都是值得欢迎的。Android - 右侧屏幕按钮

PS:按钮应该用于新的项目加入到ListView控件

而且,我创建了一个草图更好的解释。

感谢, 问候

enter image description here

+1

你可以使用的FrameLayout。 – 2014-10-08 14:04:50

+1

尝试将Thos元素放置在RelativeLayout中并设置按钮的属性android:align_ParentRight =“true”and android:center_vertically =“true” – 2014-10-08 14:06:27

+0

感谢这样一个快速回复的人,但是如果向下滚动,按钮不会向下移动,物品'以及? – jpact 2014-10-08 14:08:09

回答

1

我想对你和它工作正常。

<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" /> 

这是结果:

enter image description here

+0

非常感谢@Farouk Touzi :) – jpact 2014-10-08 14:41:03

+1

感谢Juan Aguilar Guisado也:) – 2014-10-08 14:44:26