android - Addview does not working -


i have code:

linearlayout linear = (linearlayout) findviewbyid(r.id.parameterslayout);  layoutparams b = new layoutparams(                 layoutparams.wrap_content, layoutparams.wrap_content);         textview view = new textview(this);         view.setlayoutparams(b);         view.settextcolor(color.black);         view.settext("test");         linear.addview(view); 

when use code dont see textview.

the linearlayout xml code:

<linearlayout                     android:id="@+id/parameterslayout"                     android:layout_width="match_parent"                     android:layout_height="wrap_content"                     android:layout_below="@+id/parameterschoose"                     android:orientation="vertical" >                 </linearlayout> 

but if run code again can see new textview added , previous textview aswell.

so previous textview becomes visible.

i use logs:

log.i("childs count", linear.getchildcount()+"");          if(view.getvisibility() == view.visible)             log.i("visbile", "yes");         else             log.i("visbile", "no");  

and on first them run code above get:

child count 1 , visibility yes.

i tried

linear.notify(); 

and didn't work.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -