How to implement onMeasure() for my custom widget

by silverburgh » Wed, 17 Feb 2010 02:47:34 GMT


Sponsored Links
 Hi,

I am trying to implement my own custom widget, but I am not sure how
to implement the onMeasure() for my custom Widget.

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
...
}

I want to put my custom widget in a linear layout, so that myWidget's
width can fill up the rest of the linear layout after the android
widget on the same LinearLayout :

<LinearLayout xmlns:android=" http://schemas.android.com/apk/res/android" ;
        xmlns:app=" http://schemas.android.com/apk/res/com.tmobile.socialhub" ;
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    <Button android:id="@+id/buttonA"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/buttonA" />

    <com.mycompany.MyWidget
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
           android:layout_weight="1"
            app:text="Red some more text and more text etc etc"/>

  <ImageView android:id="@+id/icon"
            android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:src="@drawable/icon" />

</LinearLayout>

--



Other Threads

1. Supported Media Formats

Hi,

I've been using MediaPlayer for playing some sounds and I've found no
way to get hold of a list of supported mime types at runtime. I was
hoping for something along the lines of MIDP's
javax.microedition.media.Manager.getSupportedContentTypes() but there
doesn't seem to be anything that achieves this on Android.
The only thing that there seems to be is a web page that lists
supported media types (at the moment and on the small amount of
devices available).

http://developer.android.com/guide/appendix/media-formats.html

Does anyone know of a way of enumerating the mime types?

Thanks,
Stephen

--~--~---------~--~----~------------~-------~--~----~

2. How to test Sipdroid using an emulator?

Hello. I have downloaded Sipdroid and I want to test how it works so that I
can learn some of the skills that have been used in its development. The
problem is- I cannot load the program into the Android emulator. While I
know how to create a new folder myself and work with the emulator, how can I
load this program into the emulator? (FYI: I am using emulator within
Eclipse).

Please assist...

--~--~---------~--~----~------------~-------~--~----~

3. How to prevent app to be removed/uninsalled

4. show and hide the titlebar

5. Mime type on download file

6. SDK USB driver for Vista SP1 won't install - Solution?

7. G1 Firmware in ADP1?