0

i need to use ListView1.TwoLinesAndBitmap

and i have strange problem to set lable,SecondLabel,imageview in center Vertically

as i see all examples set the itemheight to something like : 60dip

but when i test listview in some Hight resolution and density Device like Lenovo 10 inch tablet the height of itemheight will be very small

so i decide to use percent of Y as itemheight

here is my code : **********

ListView1.TwoLinesAndBitmap.ItemHeight = 10%y
ListView1.TwoLinesAndBitmap.ImageView.Height = ListView1.TwoLinesAndBitmap.ItemHeight - 20dip
ListView1.TwoLinesAndBitmap.ImageView.Width = ListView1.TwoLinesAndBitmap.ImageView.Height
ListView1.TwoLinesAndBitmap.ImageView.Gravity = Gravity.CENTER

ListView1.TwoLinesAndBitmap.Label.TextColor = Colors.Black
ListView1.TwoLinesAndBitmap.Label.Left = ListView1.Left
ListView1.TwoLinesAndBitmap.Label.Width = ListView1.Width
ListView1.TwoLinesAndBitmap.Label.Height = ListView1.TwoLinesLayout.ItemHeight/2
ListView1.TwoLinesAndBitmap.Label.Gravity = Gravity.CENTER + Gravity.CENTER_VERTICAL
ListView1.TwoLinesAndBitmap.Label.TextSize = ListView1.TwoLinesAndBitmap.ItemHeight * 170/1000dip


ListView1.TwoLinesAndBitmap.SecondLabel.Left = ListView1.Left
ListView1.TwoLinesAndBitmap.SecondLabel.Width = ListView1.Width
ListView1.TwoLinesAndBitmap.SecondLabel.Height =  ListView1.TwoLinesLayout.ItemHeight/2
ListView1.TwoLinesAndBitmap.SecondLabel.Gravity = Gravity.CENTER + Gravity.CENTER_VERTICAL
ListView1.TwoLinesAndBitmap.SecondLabel.TextSize = ListView1.TwoLinesAndBitmap.ItemHeight * 150/1000dip

i try to center all items in center verticaly but as i attach an image blow there is problems in all three devices ( Sony V , Lenovo tablet , AVD ) and none of them load nice

in sony V : -lable load on top -SecondLabel load on bottom - imageview not Center in vertical

in Lenovo Yoga : -lable load on top -SecondLabel load right after label on top - imageview not center vertical

in avd Emulator : -lable load on top with a little nicer space from top -SecondLabel on the bottom (0 position) !!

i`m very confused and try to change various options but no luck at all

Here is the screenshot i take of all 3 devices :

http://i58.tinypic.com/650k1u.jpg

Arman
  • 1
  • 1
  • 5

1 Answers1

0

Try this replacements and additions;

ListView1.TwoLinesAndBitmap.ImageView.Left = (ListView1.Width - ListView1.TwoLinesAndBitmap.ImageView.Width)/2

ListView1.TwoLinesAndBitmap.Label.Left = 0

ListView1.TwoLinesAndBitmap.SecondLabel.Left = 0
ListView1.TwoLinesAndBitmap.SecondLabel.Top =  ListView1.TwoLinesLayout.ItemHeight/2
Serhat MERCAN
  • 1,078
  • 3
  • 14
  • 31