嗨我正在使用Gridview
通過使用自定義適配器來顯示下面帶有文本的圖像。但問題是,當我獲取圖像和顯示,對準被改變,它不是proper.Here是我的代碼:如何在gridview android中使用完全相同的圖像和文字?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridView
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:numColumns="3" />
</RelativeLayout>
gridview.row:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/brand_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"/>
<TextView
android:id="@+id/brand_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/brand_picture"
android:gravity="center_vertical"
android:text="TextView"
android:background="@color/blue"
android:textColor="#FFFFFF" />
如何達到預期輸出相同的圖像尺寸和文字。
預期成果是:
但我的輸出看起來是這樣的。 謝謝。
使用高度和寬度的ImageView不換內容 –
也引力中心 –
說例如:如果我把imageview設置爲80dp,80dp,它不會爲所有設置設備:( – Star