Android Wear CardFrame不适应屏幕的形状

时间:2015-07-21 08:05:20

标签: android wear-os cardscrollview

我正在使用CardFrame,就像在官方教程中一样。

然而卡片框架显示在我的moto360(圆形显示屏)上,侧面有边框。它在android studio中也显示错误。 该卡用于GridViewPager的第一列,CardScrollView应自动检测形状并根据它显示卡片。 那么,我错过了什么?

此外,我注意到如果我向右滑动(取消视图),请不要松开屏幕并向左滑动...卡片显示正确(侧面没有边框) 。但是,如果我在GridView中滚动它将再次显示错误。

<android.support.wearable.view.BoxInsetLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@android:color/transparent">

<android.support.wearable.view.CardScrollView
    android:id="@+id/card_scroll_view"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    app:layout_box="bottom">

    <android.support.wearable.view.CardFrame
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:id="@+id/card"
        android:layout_gravity="bottom">

        <LinearLayout
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:orientation="vertical">
            <TextView
                android:id="@+id/title"
                android:fontFamily="sans-serif-light"
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                android:textColor="@color/grey"
                android:textSize="18sp"
                android:singleLine="true"
                android:ellipsize="end"/>
            <TextView
                android:id="@+id/fecha"
                android:fontFamily="sans-serif-light"
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                android:textColor="@color/black"
                android:textSize="16sp"
                android:maxLines="2"
                android:ellipsize="end"/>
            <TextView
                android:id="@+id/distancia"
                android:fontFamily="sans-serif-light"
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                android:textColor="@color/grey"
                android:textSize="14sp"/>
        </LinearLayout>
    </android.support.wearable.view.CardFrame>
</android.support.wearable.view.CardScrollView>

EDIT1: 我用一个小例子创建了一个存储库:https://github.com/MeinLieberScholli/cardframebug 这里有截图:http://i.stack.imgur.com/UDpxJ.png

1 个答案:

答案 0 :(得分:0)

我刚试过这个:创建了一个带有两列的简单GridViewPager,并使用您的确切布局在每列中放置了一个CardFrame,它在方形和圆形手表上都有效,有和没有下巴(以及模拟器内部) ),没有&#34; border&#34;无论是否滑动,它看起来都像预期的那样。您可能需要查看您的视图寻呼机设置或类似的东西。以下是模拟器的屏幕截图:

enter image description here