在Recycle view Grid Manner android中,Url图像加载变小

时间:2016-09-27 11:13:05

标签: android gridview android-recyclerview android-gridview

我想整合recyclelerview网格方式和加载网址图片,所以下面是我的代码

行文件

SelectMenu(menu, $index) {       
    this.clickedItem = $index;        
}

<?xml version="1.0" encoding="utf-8"?>

适配器类我设置了如下图像视图

<RelativeLayout
    android:id="@+id/rel_top"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/white"
    android:padding="10dp">

    <RelativeLayout
        android:id="@+id/rel_header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:id="@+id/img_fav"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:padding="@dimen/margin_5dp"
            android:src="@drawable/unfav" />


        <customtext.BoldText
            android:id="@+id/txt_offer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/rect_green"
            android:padding="@dimen/margin_5dp"
            android:text="OFFER"
            android:layout_centerVertical="true"
            android:textColor="#E5222D"
            android:textSize="@dimen/text_10" />
    </RelativeLayout>



    <RelativeLayout
        android:id="@+id/rel_imag"
        android:layout_width="120dp"
        android:layout_height="120dp"
        android:layout_below="@+id/rel_header"
        android:layout_centerHorizontal="true"
        android:padding="@dimen/margin_5dp">


        <ImageView
            android:id="@+id/img_promo"
            android:layout_height="match_parent"
            android:adjustViewBounds="true"
            android:layout_width="match_parent"
            android:scaleType="centerCrop"
            android:layout_centerHorizontal="true"
            android:src="@drawable/no_image" />


    </RelativeLayout>


    <customtext.RegularText
        android:id="@+id/row_txt_name"
        android:layout_width="70dp"
        android:layout_height="wrap_content"
        android:layout_below="@+id/rel_imag"
        android:layout_centerHorizontal="true"
        android:background="@drawable/rect_red"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:gravity="center"
        android:padding="@dimen/margin_5dp"
        android:text="19%"
        android:textColor="#E5222D"
        android:textSize="@dimen/text_10" />

    <customtext.RegularText
        android:id="@+id/row_txt_email"
        style="@style/NormalTextView"
        android:layout_below="@+id/row_txt_name"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="@dimen/margin_10dp"
        android:focusable="false"
        android:focusableInTouchMode="false"

        android:singleLine="true"
        android:text="Lenovo K4 Note"
        android:textColor="#555555"
        android:textSize="@dimen/text_14" />

    <RatingBar
        android:id="@+id/ratingbar"
        style="@style/customRatingBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/row_txt_email"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="10dp"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:isIndicator="true" />

    <RelativeLayout
        android:id="@+id/rel_grid_bottom"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/ratingbar"
        android:layout_marginTop="@dimen/margin_10dp"

        android:gravity="center">

        <customtext.LightText
            android:id="@+id/row_txt_gender"
            style="@style/NormalTextView"
            android:focusable="false"

            android:focusableInTouchMode="false"
            android:text="Rs. 12,399"
            android:textColor="#555555"
            android:textSize="@dimen/text_13" />

        <customtext.BoldText
            android:id="@+id/row_txt_ph"
            style="@style/NormalTextView"
            android:layout_marginLeft="@dimen/margin_10dp"
            android:layout_toRightOf="@+id/row_txt_gender"
            android:focusable="false"
            android:focusableInTouchMode="false"
            android:text="Rs. 9,999"

            android:textColor="#555555"
            android:textSize="@dimen/text_13" />
    </RelativeLayout>


</RelativeLayout>

当我运行上面的代码时,我得到o / p,如下面的图像

enter image description here

我想要大尺寸的图像任何想法我该如何解决这个问题?

0 个答案:

没有答案