Android Wear: How to Scale List View Image?

杀马特。学长 韩版系。学妹 提交于 2019-12-13 07:57:13

问题


I am trying to create a list view where every item in the list has an Image on top of a line of text. My problem is that I cannot get the Image to be any larger than 40X40, without it obscuring the view of the text underneath it. Here is my xml file:

<com.thinksai.saicloud.WearableListItemLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:gravity="center_vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:layout_gravity="center_vertical"
        android:gravity="center_vertical">

        <ImageView
            android:id="@+id/image"
            android:layout_height="40dp"
            android:layout_margin="2dp"
            android:layout_width="40dp"
            android:adjustViewBounds="true"
            android:src="@drawable/firefox"/>

        <TextView
            android:id="@+id/name"
            android:gravity="center_vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-condensed-light"
            android:textColor="#000003"
            android:textSize="16sp"
            android:layout_gravity="center_vertical"/>
            <!--android:drawableTop="@drawable/firefox"/>-->
            <!--android:drawablePadding="2dp"/>-->
    </LinearLayout>
</com.thinksai.saicloud.WearableListItemLayout>

As you can see in the commented out lines of the Textview, I tried to use the "drawableTop" instead of the Imageview, but that didn't work either. The documentation for WearableListView.setMaximizeSingleItem (http://developer.android.com/reference/android/support/wearable/view/WearableListView.html) gives me the impression that Android Wear forces the list to show three items at a time, unless there is only one item in the list. Is this correct? Is there no work around to force the wear to show one item at a time, regardless of the number of items in the list?

NOTE: I don't set the text of the text view here in the xml, I do it programmatically.

来源:https://stackoverflow.com/questions/31866487/android-wear-how-to-scale-list-view-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!