android - Dynamic layout and buttons in my existing layout after the image animation -


i trying load dynamic layout , buttons in existing layout after image animation. image has move center top of screen. after dynamic layout button visible below image. dynamic layout , button not visible.

activity_main.xml

    <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/bgm2" android:orientation="vertical" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" >  <imageview     android:id="@+id/imageview1"     android:layout_width="250dp"     android:layout_height="wrap_content"     android:layout_margintop="132dp"     android:layout_marginleft="20dp"     android:src="@drawable/jpa2" />  <progressbar     android:id="@+id/progressbar1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"      android:layout_marginleft="110dp"     android:max="100"/> 

translate.xml

<?xml version="1.0" encoding="utf-8"?> 

 <translate      android:fromxdelta="0%p"     android:toxdelta="0%p"     android:fromydelta="0%p"     android:toydelta="-26%p"     android:duration="3000"       /> 

mainactivity.java

    public class mainactivity extends activity {  progressbar probar; int progress=0; handler h = new handler(); imageview logoview; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     requestwindowfeature(window.feature_no_title);     getwindow().setflags(windowmanager.layoutparams.flag_fullscreen,             windowmanager.layoutparams.flag_fullscreen);     setcontentview(r.layout.activity_main);      logoview=(imageview) findviewbyid(r.id.imageview1);     probar=(progressbar) findviewbyid(r.id.progressbar1);     new thread(new runnable() {          @override         public void run() {             // todo auto-generated method stub               while(progress <100){                 progress+=10;                  h.post(new runnable() {                      @override                     public void run() {                         // todo auto-generated method stub                         probar.setprogress(progress);                     }                 });                 try {                      thread.sleep(1000);                     probar.setvisibility(1500);                  } catch (exception e) {                     // todo: handle exception                 }              }              }       }).start();       logoview =(imageview) findviewbyid(r.id.imageview1);     animation animation =animationutils.loadanimation(mainactivity.this, r.animator.translate);     animation.setfillafter(true);     logoview.startanimation(animation);      linearlayout ll =new linearlayout(this);     ll=(linearlayout) findviewbyid(r.id.linearlayout1);     linearlayout hl =new linearlayout(this);     hl.setorientation(linearlayout.horizontal);     linearlayout.layoutparams lp = new linearlayout.layoutparams(layoutparams.match_parent, layoutparams.wrap_content);     hl.setlayoutparams(lp);     hl.setvisibility(view.visible);     ll.addview(hl);       button bigdata =new button(this);     bigdata.setbackgroundresource(r.drawable.data);     hl.addview(bigdata);      button cloud = new button(this);     cloud.setbackgroundresource(r.drawable.cloud);     hl.addview(cloud);  }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.main, menu);     return true; } 

}

replace translate animation following:

<translate android:fromydelta="50%p" android:toydelta="0%p" android:duration="3000" /> 

feel free revert if doesn't work.

to make layout appear after animation, modify handler follows:

handler handler = new handler(); handler.postdelayed(new runnable() {        @override        public void run() {           linearlayout ll =new linearlayout(this);           ll=(linearlayout) findviewbyid(r.id.linearlayout1);           linearlayout hl =new linearlayout(this);           hl.setorientation(linearlayout.horizontal);           linearlayout.layoutparams lp =new          linearlayout.layoutparams(layoutparams.match_parent, layoutparams.wrap_content);           hl.setlayoutparams(lp);           hl.setvisibility(view.visible);           ll.addview(hl);           }   }, 3100); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -