You are setting the padding to be 36 pixels, which is going to be too
small on a high density display. On high density displays, Android
scales assets/dimensions/etc. up by 1.5, meaning a 20x20 image becomes
30x30. You should NEVER use hard coded pixel values precisely for that
reason. The easiest solution for you is to define your generic view
inside an XML layout file and inflate it at runtime. And make sure to
use the "dip" unit when specifying the padding or the height of the
generic view (your height of 64 will also be an issue on a high
density display.)

On Wed, Dec 2, 2009 at 8:44 AM, jef <[email protected]> wrote:
> I'm using an ExpandableListView in one of my activity in a
> RelativeLayout
>
> <?xml version="1.0" encoding="utf-8"?>
> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>    android:layout_width="fill_parent"
>    android:layout_height="fill_parent"
>    >
>        ...
>        <Button
>                android:id="@+id/searchNearBtnSearch"
>                android:layout_width="wrap_content"
>                android:layout_height="wrap_content"
>                android:text="@string/search"
>                android:layout_centerHorizontal="true"
>            android:layout_below="@id/searchNearSpinner"
>            android:background="@drawable/btn_and_showtime"
>                />
>        <ExpandableListView
>       android:id="@+id/searchNearListResult"
>       android:layout_width="fill_parent"
>       android:layout_height="fill_parent"
>            android:layout_below="@id/searchNearBtnSearch"
>       />
> </RelativeLayout>
>
> and I'm using a custom expandableListAdaptaer which group view is :
>
> public TextView getGenericView() {
>                // Layout parameters for the ExpandableListView
>                AbsListView.LayoutParams lp = new AbsListView.LayoutParams( //
>                                ViewGroup.LayoutParams.FILL_PARENT, 64);
>
>                TextView textView = new TextView(mainContext);
>                textView.setLayoutParams(lp);
>                // Center the text vertically
>                textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
>                // Set the text starting position
>                textView.setPadding(36, 0, 0, 0);
>                return textView;
>        }
>
> (Found on examples of API_Demos, ExpandableList1)
>
> A user of my application report me this photo
> http://binomed-android-project.googlecode.com/issues/attachment?aid=-2990980965246303896&name=AndroidShowtime.jpg
> As you can see, the indicator of group items is over the text of group
> item despite the padding of 36...
>
> And if I'm running emulator WVGA800 or an emulator with "abstracted
> LCD density" to 240 I have the same problem, but with my phone (HTC
> G1), I don't have any problem.
>
> What is strange is that I try the application API_Demo with an
> emulator WVGA800 or an emulator with "abstracted LCD density" to 240
> and I go to ExpandableList1 activity and all is alright !
>
> I also try to copy the inner class available in ExpandableList1 for
> adapter and I launch it into my activity and I also have the problem
> see on photo
>
>
> What I am doing wrong... ? I am forced to manage density into my
> adapters in order to adjust the padding ?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to