开发者

How add a floating view in Activity

开发者 https://www.devze.com 2023-02-06 18:00 出处:网络
I build a SideBar menu that contains some icons, when clicking on one of them, I need to popover a view next to the bar with a View inside of it.

I build a SideBar menu that contains some icons, when clicking on one of them, I need to popover a view next to the bar with a View inside of it.

My question is how add this view in top of any view that is not in the bar.

Just for clarify, this is my layout to get the SideBar on screen.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical" android:layout_width="match_parent"
 android:layout_height="match_parent">
 <ImageView android:id="@+id/image01" android:layout_width="wrap_content"
  android:layout_height="wrap_content" android:scaleType="fitXY" />
 <com.view.SideBarView android:id="@+id/sideBar"
  android:layout_width="40px" android:layout_height="match_parent"
  layout_toLeftOf="@id/image01" />
</RelativeLayout>

I need when click a icon on the bar to pop over the image on the left, and also have a View inside the balloon and get some user input.

If it's not too much, I need to draw a arrow next to the icon to this floating view.

There's an way t开发者_如何学运维o do that?


After searching I discovery how do that, I can do it with AbsoluteLayout (but I don't like it), so I discover my second option, use a PopupWindow to show my Content as a floating view.

This works perfectly.


@Marcos If all you're looking is Floating Views you may use RelativeLayout , FrameLayout or AbsoluteLayout as described in this post "Creating Floating Views in Android".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号