Hi,

I've got a custom class being loaded up by my layout XML, and drawing
to the screen. This much works perfectly.

First some background: In my main layout XML I define a tabhost,
linearlayout, framelayout and tabwidget. Following on from this, each
activity has its own layout XML that defines how its UI is laid out
inside the parent framelayout when the activities are launched by
selecting a tab.

The problem comes when I try to draw a line at the bottom of the
canvas in the overridden onDraw(Canvas) function in my custom view
(class CompassView extends View); it is drawn underneath the tabwidget
defined in the main parent XML!

I fetch the size of the canvas with canvas.getHeight(). The value it
returns seems to include the space underneath the tabwidget, but not
the space occupied by the notification bar at the top. Note that my
tabwidget is at the bottom of the screen.

Here is the layout for the child view which sits inside the
framelayout of the parent XML:

--------------------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:id="@+id/compass"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
    <com.tjhowse.geoloc.CompassView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"/>
</LinearLayout>
--------------------------------

At the start of the constructor for my custom view:

--------------------------------
public CompassView(Context context, AttributeSet attrs) {
    super(context, attrs);
    setLayoutParams(new LayoutParams(context, attrs));
    ...
--------------------------------

I would've thought the fill_parent attribute would've prevented the
view, and thus the canvas, from overlapping with the tabwidget. If I
replace my custom class with:

--------------------------------
<Button android:id="@+id/pbTest"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:text="BUTAN OMG" />
--------------------------------

...the button correctly fills the available space, and has a proper
bottom edge that clearly finishes before it intersects the tabwidget.

Any thoughts?

Thanks,
tjhowse.

-- 
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

Reply via email to