简体   繁体   中英

How to setup a card view in a corner

I have an activity currently setup where there is a camera preview setup in a surface view. I am looking to implement a card view that scrolls similar to this: https://developers.google.com/glass/develop/gdk/ui-widgets

The cards will show information regarding the images being looked at. Any idea how to have the card scroll concept implemented such that it takes up the upper right corner of the screen?

The CardScrollView is a basic Android view and it can be used in an xml layout file. I haven't tried what you are asking but I have managed to put an overlay over the CardScrollView so making it smaller and putting it in the corner could be possible as well.

I can't test it right now, but try out the following layout:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

    <SurfaceView
      android:id="@+id/surface_view"
      android:layout_width="match_parent"
      android:layout_height="match_parent" />

    <com.google.android.glass.widget.CardScrollView
      android:id="@+id/card_scroll_view"
      android:layout_width="120px"
      android:layout_height="90px"
      android:layout_gravity="top|right"
      android:layout_marginTop="5px"
      android:layout_marginRight="5px" />
</FrameLayout>

You can find more information on the FrameLayout here:

http://blog.neteril.org/blog/2013/10/10/framelayout-your-best-ui-friend/

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