Android - Layout not in uniform -


i have horizontal list of images in android application. problem of images seems not follow layout i've defined in xml. this:

suppose should in uniform distance

my layouts this: mainlayout.xml

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@drawable/back_shop_list"     android:orientation="horizontal">    <com.devsmart.android.ui.horizontallistview       android:id="@+id/shop_hlist_view"        android:layout_width="match_parent"        android:layout_height="match_parent"       android:paddingleft="5dp"       android:paddingright="5dp"       android:scrollx="1dp"       android:scrolly="1dp"       android:overscrollmode="always" >     </com.devsmart.android.ui.horizontallistview>  </linearlayout> 

then listlayout.xml

 <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:translationy="200dp" >        <framelayout          android:id="@+id/framelayout"          android:layout_height="wrap_content"          android:layout_width="wrap_content"          android:layout_gravity="center"         android:orientation="vertical"         android:paddingleft="8dp"         android:paddingright="8dp" >          <imageview             android:id="@+id/img"                 android:clickable="true"             android:adjustviewbounds="true"             android:layout_width="360dp"             android:layout_height="360dp" />            <progressbar             android:id="@+id/img_progress"             style="?android:attr/progressbarstylelarge"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:indeterminate="true"             android:translationy="150dp"             android:translationx="140dp" />       </framelayout>      <textview         android:id="@+id/labeltext"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:translationx="10dp"         android:textcolor="#dc6800"         android:textsize="16sp"         android:textstyle="bold" />     <!-- description label -->     <textview         android:id="@+id/desc"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:translationx="10dp"         android:textcolor="#acacac"         android:paddingbottom="2dip">     </textview>  </linearlayout> 

my guess size of image lesser imageview layout_width , height. or dont know causes problem. do, please. thanks.

edit: wanted if image image 4 , image 5, should not have spaces. i've tried getting size of image imageloader set layout parameters height , width in there while images loaded. looked worse. there other ways in can dynamically adjust imageview if ever images image 4 , 5?

if want make image occupy desired space

try adding image view property imageview

you can try others use fitxy out of predefined list there in xml layout

android:scaletype="fitxy" 

so make property work need

android:adjustviewbounds="true" 

that have added in case

if want avoid on blank spaces , let image occupy space want

in layout using 2 image views show demo

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/ll_numbers"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:layout_alignleft="@+id/tv_numbers"     android:layout_below="@+id/tv_numbers"     android:layout_margintop="5dip"     android:layout_marginright="10dip"     android:orientation="vertical">      <imageview         android:id="@+id/textview1"         android:layout_width="200dip"         android:layout_height="200dip"         android:src="@drawable/desert"/>      <imageview         android:id="@+id/textview2"         android:layout_width="200dip"         android:layout_height="200dip"         android:background="@drawable/desert"/>   </linearlayout> 

imageview 1 assigning image source using android:src="@drawable/desert"

and below result can notice showing whitespace arround it.

enter image description here

imageview2 assigning image background using android:background="@drawable/desert" , below result can notice showing no whitespace arround it.

enter image description here

or try using these attributes make possible

android:maxheight=""         android:maxwidth=""         android:minheight=""         android:minwidth="" 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -