How do I add a border to my entire android app programmatically? -
i trying add 10 pixel border sides of app, breaks every time try add margin/padding. can give me clue need doing make happen? i've included code below. first post if have done wrong apologize in advance.
import android.app.activity; import android.content.context; import android.os.bundle; import android.view.motionevent; import android.view.keyevent; import android.view.window; import android.view.windowmanager; import android.view.view; import android.view.viewgroup; import android.widget.textview; import android.widget.edittext; import android.text.editable; import android.widget.button; import android.widget.imageview; import android.widget.linearlayout; import android.widget.framelayout; import android.graphics.drawable.drawable; import android.content.res.configuration; import android.app.notification; import android.app.notificationmanager; import android.app.pendingintent; import android.content.intent; import android.view.view.onkeylistener; import android.view.menuitem; import android.view.menu; import android.view.gravity; import android.text.method.textkeylistener; import java.util.linkedlist; import java.io.sequenceinputstream; import java.io.bufferedinputstream; import java.io.ioexception; import java.io.inputstream; import java.io.outputstream; import java.io.fileoutputstream; import java.io.file; import java.io.fileinputstream; import java.util.zip.*; import java.util.zip.zipentry; import java.util.zip.zipinputstream; import java.util.set; import android.text.spannedstring; import java.io.bufferedreader; import java.io.bufferedinputstream; import java.io.inputstreamreader; import android.view.inputmethod.inputmethodmanager; import android.content.pm.packageinfo; import android.content.pm.packagemanager; import android.os.handler; import android.os.message; import java.util.concurrent.semaphore; import android.content.pm.activityinfo; import android.view.display; import android.text.inputtype; import android.util.log; public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setrequestedorientation(globals.horizontalorientation ? activityinfo.screen_orientation_landscape : activityinfo.screen_orientation_portrait); instance = this; // fullscreen mode requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); if(globals.inhibitsuspend) getwindow().setflags(windowmanager.layoutparams.flag_keep_screen_on, windowmanager.layoutparams.flag_keep_screen_on); log.i("sdl", "libsdl: creating startup screen"); _layout = new linearlayout(this); _layout.setorientation(linearlayout.vertical); _layout.setlayoutparams(new linearlayout.layoutparams(viewgroup.layoutparams.fill_parent, viewgroup.layoutparams.fill_parent)); _layout2 = new linearlayout(this); _layout2.setlayoutparams(new linearlayout.layoutparams(viewgroup.layoutparams.fill_parent, viewgroup.layoutparams.wrap_content)); final semaphore loadedlibraries = new semaphore(0);
farther down...
setcontentview(_videolayout); class callback implements runnable { mainactivity p; callback( mainactivity _p ) { p = _p; } public void run() { try { thread.sleep(200); } catch( interruptedexception e ) {}; if(p.maudiothread == null) { log.i("sdl", "libsdl: loading libraries"); p.loadlibraries(); p.maudiothread = new audiothread(p); log.i("sdl", "libsdl: loading settings"); final semaphore loaded = new semaphore(0); class callback2 implements runnable { public mainactivity parent; public void run() { settings.load(parent); loaded.release(); loadedlibraries.release(); } } callback2 cb = new callback2(); cb.parent = p; p.runonuithread(cb); loaded.acquireuninterruptibly(); if(!globals.compatibilityhacksstaticinit) p.loadapplicationlibrary(p); }
main.xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > </linearlayout>
Comments
Post a Comment