Generating a RelativeLayout in Java

by Fr盲ntz Miccoli » Thu, 26 Jun 2008 15:04:57 GMT


Sponsored Links
 Can someone please give me an example of an implentation of a custom view
extending a relative layout and not using XML.

For exemple the builder of mine with absolutelayout :

    public VideoListRowView(Context context,int position) {
        super(context);

        //WARNING YOU MUST DEFINE EACH ATTRIBUTE NEEDED FOR THE CHOOSEN
LAYOUT
        //ATTENTION DEFINIR IMPERATIVEMENT TOUT LES ATTRIBUTS OBLIGATOIRES
DU LAYOUT CHOISI
        setLayoutParams(new
AbsoluteLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT, 0, 0));
        this.setPadding(paddingLeft, paddingTop, paddingRight,
paddingBottom);

        mTitle = new TextView(context);
        mTitle.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
        mTitle.setMaxLines(1);
        addView(mTitle, new AbsoluteLayout.LayoutParams(
                maxWidth - thumbailWidth,
LayoutParams.WRAP_CONTENT,xTitle,yTitle));
        mTitle.setPadding(0, 0, titlePaddingRight, 0);

        mSumup = new TextView(context);
        mSumup.setMaxLines(3);
        mSumup.setHorizontallyScrolling(false);
        addView(mSumup, new AbsoluteLayout.LayoutParams(
                maxWidth - thumbailWidth,
LayoutParams.WRAP_CONTENT,xSumup,ySumup);

    }

My problem is to defined through Java the same behavior than you have when
you use the android:layout_toRight and android:below attribute

Thanks !

-- 
Frntz Miccoli
06.70.92.76.16
[EMAIL PROTECTED]

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



Other Threads

1. How To Call Methods Of Activity From A Service

Hello,

Is it possible to call methods of a Activity from service.

I am running a thread from a service and i listening to some external
event from that thread.
I am not able to call methods  from that thread. Is there any way to
call methods from a thread.

Thank you


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

2. 1.5 SDK issue

My app consists of a dialog-style activity with only one
AutoCompleteTextView.
In 1.1 the drop-down view of the AutoCompleteTextView was drawn down
till the bottom of the screen. But now in 1.5, it is only drawn down
to the bottom of the dialog box. So the drop-down is only a few pixels
high.
Is this the intended behaviour now?
--~--~---------~--~----~------------~-------~--~----~

3. orientation change runtime option?

4. How automatically install a 3rd-party static lib or so in Android.mk

5. ANT Build files sdk 1.5 and beyond

6. Why the service is always to restart even if force to kill it?

7. problem with KeyEvent.KEYCODE_PLUS in SDK 1.5pre