简体   繁体   English

如何在角落设置卡片视图

[英]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 我正在寻求实现类似于以下内容的卡片视图: 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. CardScrollView是一个基本的Android视图,可以在xml布局文件中使用。 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. 我没有尝试您要的内容,但是我设法在CardScrollView上放置了一个覆盖层,因此可以使其变小并放在角落。

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: 您可以在此处找到有关FrameLayout更多信息:

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

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

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