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 use cache memory to store data temporary?

hi,

is there anyway to store data to cache memory for certain time?

regards,
hitendra gohil

-- 

2. Outgoing phone calls going through Dialer interface in android

Hello
       I want to distinguish between the outgoing phone calls going
through Dialer user interface and not going through Dialer user
interface in Android. Please give me its solution if there is any way
in android. Also I want to retrieve package name of application
generating outgoing phone calls. I used Intent.getPackage() method,
but it is returning null string.

Thanks in advance.

-- 

3. Is it possible to add header to TabHost in android ?

4. Salam kenal dari Nubie

5. why using different ubuntu 32/64 to develop android app and porting android?

6. how to set permission for changing wallpaper

7. Perform device detection check after reboot