My application uses a ListView to display a custom TextView as a tree view, with the text indented according to the item's depth in the tree. In that indentation, a line drawing denotes the hierarchy. I tried to use the setPadding() within onDraw() to indent the text, but that is causing a seemingly endless onDraw() loop ... perhaps due to layout recalculations. Is there another easy method of adding left indentation to text that doesn't cause this drawing loop problem?
My onDraw() and row layout XML are as follows: @Override protected void onDraw(Canvas canvas) { // some canvas.drawPath() drawn lines denoting tree hierarchy // unsuccessful attempt at indenting text according to mLineDepth (set in ListAdapter) setPadding(mLineDepth * PIXELS_PER_DEPTH_LAYER + PIXELS_OFFSET_TO_NAME,0,0,0); super.onDraw(canvas); } - - - <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <view class="com.mycom.myapp.TClass$MyUnderlinedTextView" android:id="@+id/tlist_utext" android:layout_weight="1" android:layout_width="0dip" android:layout_height="fill_parent" android:textSize="22dip" android:singleLine="true" android:ellipsize="marquee" android:background="@android:color/transparent" /> <ImageView android:id="@+id/icon" android:layout_width="48dip" android:layout_height="48dip" /> </LinearLayout> - - - Best regards, Greg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---