I found bunch of samples how to remove title/notification bar on Android. However, it's still not a full screen.
I still see a panel on my table with search, home, back and some other button.
Do you have any ideas how to hide this panel?
Generally speaking, I want kind of kiosk mode.
Use this code in onCreate of activity:
getWindow().setFlags(LayoutParams.FLAG_FULLSCREEN, LayoutParams.FLAG_FULLSCREEN);
Sample code for a fullscreen activity:
public class HellofullActivity extends Activity {
/** Called when the activity is first created. */
#Override
public 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.main);
}
}
where you request that the window has not the green title bar and take full screen.
The core problem was device specific. I was doing development for Archos and Archos has it's own bar, which isn't not removed by FLAG_FULLSCREEN and FEATURE_NO_TITLE
Related
I am using
react native smart splash screen.
my question is
is there any way to hide status-bar on splash screen in android ?
(its working fine in ios).
On MainActivity.java, just like that:
#Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this, true); // <- second parameter is true, to hide StatusBar
super.onCreate(savedInstanceState);
}
source: https://github.com/crazycodeboy/react-native-splash-screen/issues/105#issuecomment-401966983
I'm developing an app that uses the sensor accelerometer. I want the display to go black for instance when a value reach 8.1 and go back to normal when 7 is reached. Is it possible without using screen brightness? I want it to be complete black and this is not possible what i know with screen brightness.
Hope I gave enough information.
Try this in your activity. Let your main.xml load a black image -
public class MainActivity extends Activity {
#Override
public 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.main);
}
}
Since you also need the screen to be black while you are using other apps. Then you need to write a background service that receives the accelerometer values and when it reaches 8.1, you can use the above snippet of code in your service.
I have tried several things in order to hide the status bar in my app. It seems to work, but several users complain they still see the status bar. So, it looks like all proper solutions I have used, do not cover all devices/settings.
Here are the things I already added to my project:
In the AndroidManifest:
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen"
In the onCreate() method:
requestWindowFeature( Window.FEATURE_NO_TITLE );
getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN );
getWindow().getDecorView().requestLayout();
Now, this does work for almost all of my users. But some of them still see the status bar, even Galaxy S2 and S3 users (NOT ALL!).
Are there any other options left that I could try?
Try using only the Java code in onCreate() without the android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen".
Put the Java code to the beginning of your onCreate():
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
I am using the code from this post to put a loading icon in the title bar of my Android App:
#Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.your_layout);
}
The code:
activity.setProgressBarIndeterminateVisibility(true);
is called in an AsyncTask. If the user navigates to a new activity, the icon is not longer present in the title bar since the icon was set for the first activity only.
Is there a way to have the icon show on all activities? Thanks in advance.
You can create super activity (i.e. Base Activity), include the below line in this super activity:
activity.setProgressBarIndeterminateVisibility(true);
And extends this activity to all the child activities.
i`m trying to show indeterminate progress bar in ABS v. 4.0.2 by following code
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.main);
getSherlock().setProgressBarIndeterminateVisibility(true);
}
on ICS virtual device it works fine, but progress do not shows in device with Android 2.1.
what i`m doing wrong?
Make sure you import com.actionbarsherlock.view.Window, not android.view.Window.
Try setSupportProgressBarIndeterminateVisibility(boolean) to get backward compatibility.
do this:
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.section_one1);
setSupportProgressBarIndeterminateVisibility(false);
on anything clickable like starting an activity via intent or adapters or whatever
show your progressbar on click
setSupportProgressBarIndeterminateVisibility(true);
but using this method when the user goes back to the activity the progress dialog will be visible still. There are many ways to stop it but the easiest one is just to use
#Override
public void onBackPressed()
{
NavUtils.navigateUpFromSameTask(this);
super.onBackPressed();
}