Search code examples
androidlayoutreload

How to reload interface from onLayout?


I've got this GUI:

LinearLayout

-TableLayout heading
-ViewFlipper flipper
    - TableLayout1
    - TableLayout2
    - TableLayout3
       ... (dynamicly added)

I change the width of t1 in vf.onLayout(..) but i'm not able to redraw it.... please help :/ Here is the code:

 @Override
 protected void onLayout(boolean changed, int left, int top, int right,
 int bottom) {
 super.onLayout(changed, left, top, right, bottom);

 Log.i(TAG, "flipper onLayout");

 int idx = this.getDisplayedChild();
 Log.i(TAG, "flipper displayed child is: " + idx);
 this.heading.cols_widths = some_cols_widths;
 this.heading.resize_cols();
 LinearLayout lay = (LinearLayout) this.heading.getParent();
 lay.requestLayout();    
 }

This drives me mad :/


Solution

  • So the answer is like nininho wrote upper:

    "use postDelayed to call requestLayout."