I have a listview, and one list item consist of two textview's and an imageview(actual image is downloaded from server with help of ION library). I want to fit exactly 3 list items on the screen, but as screen resolutions vary I cant do it simply with setting item height.
What i've tried is:
vi_params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, (int)(MainActivity.screenHeight*0.33));
userImage.setLayoutParams(vi_params);
But this gives event different result - no image is shown at all.
This is how my list_item.xml looks like.
<RelativeLayout
android:id="@+id/widget32"
android:layout_width="fill_parent"
android:layout_height="110dp"
xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_x="0dp"
android:layout_y="0dp">
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="260dp"
android:layout_x="0dp"
android:layout_y="0dp"
android:scaleType="fitXY"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/ID"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:visibility="invisible"/>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="TextView" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:text="TextView" />
</RelativeLayout>
So, any ideas how to make list item height depending on screen height, so only three would fit?
No comments:
Post a Comment