Hi guys,

I'm declaring some view inside my layout xml file and then I'm trying
to figure out their location with getTop(), bottom, right, left etc.
However, the end result is that it always returns 0, why is this?

Here is the implementation:

public TextView mDropHere;
        public TextView mOne;
        public TextView mTwo;
        public LinearLayout mViewParent;


    @Override
    public void onCreate(Bundle icicle) {

        super.onCreate(icicle);
        setContentView(R.layout.main);

        mDropHere = (TextView) findViewById(R.id.drophere);
        mOne = (TextView) findViewById(R.id.one);
        mTwo = (TextView) findViewById(R.id.two);
        mViewParent = (LinearLayout) findViewById(R.id.viewparent);

        Log.e("DropHere",       Integer.toString(mDropHere.getBottom()) + "
" +
                                                
Integer.toString(mDropHere.getLeft()) + " " +
                                                
Integer.toString(mDropHere.getRight()) + " " +
                                                
Integer.toString(mDropHere.getTop()));
        Log.e("mOne",   Integer.toString(mOne.getBottom()) + " " +
                                                
Integer.toString(mOne.getLeft()) + " " +
                                                
Integer.toString(mOne.getRight()) + " " +
                                                
Integer.toString(mOne.getTop()));
        Log.e("mTwo",   Integer.toString(mTwo.getBottom()) + " " +
                                                
Integer.toString(mTwo.getLeft()) + " " +
                                                
Integer.toString(mTwo.getRight()) + " " +
                                                
Integer.toString(mTwo.getTop()));
        Log.e("mViewParent",
Integer.toString(mViewParent.getBottom()) + " " +
                                                                
Integer.toString(mViewParent.getLeft()) + " " +
                                                                
Integer.toString(mViewParent.getRight()) + " " +
                                                                
Integer.toString(mViewParent.getTop()));
    }






<TextView
                android:id="@+id/drophere"
            android:layout_width="150px"
            android:layout_height="100px"
            android:text="Drop here!"
            android:textAppearance="?android:attr/textAppearanceLarge"
            />
        <TextView
                android:id="@+id/two"
            android:layout_width="150px"
            android:layout_height="100px"
            android:text="1"
            android:textAppearance="?android:attr/textAppearanceLarge"
            />
        <TextView
                android:id="@+id/one"
            android:layout_width="150px"
            android:layout_height="100px"
            android:text="2"
            android:textAppearance="?android:attr/textAppearanceLarge"
            />


Cheers,
Charles

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to