android - How to properly inflate a layout with a nested ViewFlipper? -


i used have simple main.xml layout had 2 views flipped via viewflipper wrapper. worked (still works) great, using following code:

setcontentview(r.layout.main); mtv1 = (textview) findviewbyid(r.id.textview01); mtv2 = (textview) findviewbyid(r.id.textview02); mviewflipper = (viewflipper)findviewbyid(r.id.flipper01); 

i want add 2 buttons on top of original views, in fashion similar this:

<linearlayout  android:id="@+id/linearlayout01"   android:layout_width="fill_parent"   android:layout_height="fill_parent"   android:orientation="vertical"   xmlns:android="http://schemas.android.com/apk/res/android">  <linearlayout  android:id="@+id/linearlayout02"   android:layout_width="fill_parent"   android:layout_height="wrap_content">     <button android:id="@+id/button01" android:layout_height="wrap_content" android:text="button 1" android:layout_width="0dip" android:layout_weight="1"></button>     <button android:id="@+id/button02" android:layout_height="wrap_content" android:text="button 2" android:layout_width="0dip" android:layout_weight="1"></button> </linearlayout>  <relativelayout  android:id="@+id/relativelayout01"   android:layout_width="fill_parent"   android:layout_height="0dp"  android:layout_weight="1">     <viewflipper         android:id="@+id/flipper01"         android:layout_width="fill_parent"         android:layout_height="fill_parent"         >     <textview         android:id="@+id/textview01"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="text"         />           <textview         android:id="@+id/textview02"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="text2"         />        </viewflipper>     </relativelayout> </linearlayout> 

my problem intuitively modified original code inserting findviewbyid composite layout:

setcontentview(r.layout.main); mcompositelayout = (linearlayout) findviewbyid(r.id.linearlayout02); mtv1 = (textview) findviewbyid(r.id.textview01); mtv2 = (textview) findviewbyid(r.id.textview02); mviewflipper = (viewflipper)findviewbyid(r.id.flipper01); 

but displays same before! if never added linearlayout02 containing buttons.

what missing? doing wrong?

try project->clean (if use eclipse) , insure editing right main.xml file. code works, neither compositelayout nor viewflipper matters, buttons drawn.

if you're sure nothing missing , buttons still not drawn try add android:layout_weight new linearlayout (containing buttons). (for galaxy nexus ok without weight problem may appear because of android device fragmentation)


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -