java - Cannot make a fullscreen Android Presentation on the second screen -


my question android facility utilizing secondary screen of device, i.e. android.app.presentation

i'm using wrapper: https://github.com/commonsguy/cwac-presentation

unfortunately cannot force second screen layout in fullscreen mode: although width matches screen, height restricted stripe in center of screen, approximately 1/4 of screen height

correspondingly, content displayed within narrow boundary, while remaining parts of screen keep staying black , useless

for don't have idea api,
android.app.presentation special type of dialog shown on secondary screen of device,
wrapper i've mentioned above, based on presentationfragment extends dialogfragment. user creates class extending presentationfragment, , in overridden oncreateview() creates layout wishes displayed on second screen. example:

    public class custompresentationfragment extends presentationfragment {          public static custompresentationfragment newinstance(context ctxt,                                                              display display) {          custompresentationfragment frag=new custompresentationfragment();          frag.setdisplay(ctxt, display);          //we may prepare bundle pass, if necessary         //bundle b=new bundle();         //b.putstring("key1", value1);         //b.putstring("key2", value2);         //frag.setarguments(b);           return(frag);         }          @override       public view oncreateview(layoutinflater inflater,                                viewgroup container,                                bundle savedinstancestate) {        view myview = new view(getcontext());               //here create layout want displayed on second screen, , return        return(myview);        }   } 

this implementation of presentationfragment. see, contains presentation variable:

package com.commonsware.cwac.preso;  import android.app.dialog; import android.app.dialogfragment; import android.app.presentation; import android.content.context; import android.os.bundle; import android.view.display;  public abstract class presentationfragment extends dialogfragment  {    private display display = null;    private presentation preso = null;     public dialog oncreatedialog(bundle savedinstancestate)    {      if (this.preso == null) {        return super.oncreatedialog(savedinstancestate);          //instead of returning super value, have tried following here,        //with no success:        //        //dialog dlg = super.oncreatedialog(savedinstancestate);        //dlg.getwindow().clearflags(windowmanager.layoutparams.flag_force_not_fullscreen);        //dlg.getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen);        //dlg.getwindow().setlayout(layoutparams.match_parent, layoutparams.match_parent);        //return dlg;      }       return this.preso;    }     public void setdisplay(context ctxt, display display) {      if (display == null) {        this.preso = null;      }      else {        this.preso = new presentation(ctxt, display, gettheme());         //since presentation dialog, have tried same here well,        //no success:         //this.preso.getwindow().clearflags(windowmanager.layoutparams.flag_force_not_fullscreen);        //this.preso.getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen);        //this.preso.getwindow().setlayout(layoutparams.match_parent, layoutparams.match_parent);        }       this.display = display;    }     public display getdisplay() {      return this.display;    }     protected context getcontext() {      if (this.preso != null) {        return this.preso.getcontext();      }       return getactivity();    } } 

edit. oncreateview() 1 of presentationfragments:

@override       public view oncreateview(layoutinflater inflater,                                viewgroup container,                                bundle savedinstancestate) {        string uri = "somefilepath";       file imgfile = new  file(uri);       bitmap mybitmap = bitmapfactory.decodefile(imgfile.getabsolutepath());        imageview view = new imageview(getcontext());       view.setimagebitmap(mybitmap);       view.setlayoutparams(new relativelayout.layoutparams(layoutparams.match_parent, layoutparams.match_parent));        relativelayout prelative = new relativelayout(getcontext());          prelative.setlayoutparams(new relativelayout.layoutparams(layoutparams.match_parent, layoutparams.match_parent));        prelative.setgravity(gravity.center);        prelative.addview(view);        return prelative;               } 

first, parent of relativelayout not relativelayout, , therefore should not trying set relativelayout's layoutparams instance of relativelayout.layoutparams.

second, rewrite xml layout , inflate it. relativelayout has better chance of working then, know parent @ inflation time. relativelayout finicky beast. option switch away relativelayout else can centering, such framelayout.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -