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. newbie - contact journey td sync?

Dear suhu android,

perkenalkan newbie pakai juned baru 1 bulan..
mohon info, kenapa sdh 1 bln contact sync, tapi tetap kosong ya?
dah muter2 gak ketemu cara sync langsung/direct ke Mac.

terus kok sms langsung full tidak bisa terima lagi pdhal tdk pernah
terima sms lain selain dr operator 3..
utk juned, menu sms memang agak lelet ya? {*filter*}tara blm berani jd HH
utama krn masalah sms ini..

terimakasih,
nug

-- 
===============
"

2. Solved - Error install aplikSi

Solved,

Mungkin ada yang punya problem serupa, penyelesaiannya adalah hapus file
smdl2tmp1.asec dengan cara :

1. jalankan terminal emulator,
2. Ketik su,
3. Ketik rm /mnt/secure/asec/smdl2tmp1.asec
4. Enter.

Solved. Thanks :D

- HTC Desire HD



-- 
===============
"

3. Build.SERIAL deprecated?

4. ListAdapter design advice

5. Does Any one Building Android source code in Mac

6. Quick Question about developer platform

7. Read Response from PHP server