It's posiable to create a LinearLayout layout and put some controls in
it.
look at here (InternalSelectionFocus.java in ApiDemos):

        final LinearLayout layout = new LinearLayout(this);
        layout.setOrientation(LinearLayout.HORIZONTAL);
        layout.setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        LinearLayout.LayoutParams params = new
LinearLayout.LayoutParams(0,
                ViewGroup.LayoutParams.FILL_PARENT, 1);

        final InternalSelectionView leftColumn = new
InternalSelectionView(this, 5, "left column");
        leftColumn.setLayoutParams(params);
        leftColumn.setPadding(10, 10, 10, 10);
        layout.addView(leftColumn);

        final InternalSelectionView middleColumn = new
InternalSelectionView(this, 5, "middle column");
        middleColumn.setLayoutParams(params);
        middleColumn.setPadding(10, 10, 10, 10);
        layout.addView(middleColumn);

        final InternalSelectionView rightColumn = new
InternalSelectionView(this, 5, "right column");
        rightColumn.setLayoutParams(params);
        rightColumn.setPadding(10, 10, 10, 10);
        layout.addView(rightColumn);

        setContentView(layout);


On Apr 3, 2:35 am, Craig <[EMAIL PROTECTED]> wrote:
> Is there a more efficient way to create rows for a listview other than
> to use ViewInflate over and over?  Is there much of a performance gain
> by creating the views programmatically rather than in xml (although I
> do perfer the maintainability of the xml approach)?  Since I am
> inflating the same definision over and over again can I do the inflate
> once and somehow clone the result?  Or is this not practical since the
> xml definision is already optimized for inflation during compile
> time?  NOTE: I am already skipping the inflate if an old row's view is
> passed in to the getview method.
>
> I am looking into this because the screens that take long to bring up
> (with there lists filled) spend 95% of their time inflating the views
> for these rows (4.5 seconds for approx 20 rows according to the
> profiler)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to