【问题标题】:How do you make an imageview larger in ListView如何在 ListView 中使图像视图更大
【发布时间】:2016-04-22 10:06:48
【问题描述】:

我的 ListView 有问题。我想在 ListView 中放大图像。 我试图设置 android:layout_height="match_parent" 但它不起作用:(

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <SquaredFrameLayout
        android:id="@+id/vImageRoot"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:id="@+id/ivFeedCenter"
            android:layout_width="match_parent"
            android:src="@drawable/img_feed_center_2"
            android:layout_height="match_parent" />

    </SquaredFrameLayout>

    <ImageView
        android:id="@+id/ivFeedBottom"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="8dp"
        android:paddingRight="8dp">

        <ImageButton
            android:id="@+id/btnLike"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:background="@drawable/btn_feed_action"
            android:src="@drawable/ic_heart_small_blue" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center_vertical|right">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_heart_small_blue" />

            <TextSwitcher
                android:id="@+id/tsLikesCounter"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="8dp"
                android:layout_marginRight="8dp"
                android:inAnimation="@anim/slide_in_likes_counter"
                android:outAnimation="@anim/slide_out_likes_counter">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="123 likes"
                    android:textColor="@color/text_like_counter" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/text_like_counter" />
            </TextSwitcher>
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

我希望它看起来 但它看起来像

对不起我的英语不好:) 非常感谢。

【问题讨论】:

    标签: java android xml android-layout listview


    【解决方案1】:
    <ImageView  
            android:scaleType = "centerCrop"
            android:id="@+id/ivFeedCenter"
            android:layout_width="match_parent"
            android:src="@drawable/img_feed_center_2"
            android:layout_height="match_parent" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-31
      • 1970-01-01
      • 2016-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多