looks like i have a smaller Problem but cant find why.
In my SherlockFragmentActivity onCreate i do the following:
#Override
public void onCreate(final Bundle savedInstanceState)
{
requestWindowFeature(Window.FEATURE_PROGRESS);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
The AndroidManifest.xml
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
In an Fragment which loads some Data i do a simple:
getSherlockActivity().setSupportProgressBarIndeterminateVisibility(true);
All working great on ICS, but same code running on my 3.1 Tablet never show an ProgressBar when requested. Anyone can give me an hint why this happen ?
I also have the problem in the Emulator running 2.2, no Progress ever shown. I looked again into FeatureToggles from the Sherlock Samples, same code, different result :/
PS: Using 4.01 of ActionBar Sherlock
Make sure you are using the com.actionbarsherlock.view.Window import instead of android.view.Window.
If you miss this import change the progress method calls will only ever work on ICS and newer devices.
Related
I have an fullscreen apllication. I'm using requestWindowFeature(Window.FEATURE_NO_TITLE) to remove the title. This works very well for my 4.1.2 Smartphone and the 4.4.2 Emulator.
In the 2.2 Emulator, on my 2.2 Smartphone and on my 2.3.6 tablet the title is still being displayed. I tried very much things like changing styles in the Manifest or editing those styles in the styles.xml, nothing works.
Here's my 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);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
GameData.display = new Display(this);
setContentView(GameData.display);
CoreData.mainActivity = this;
NetworkData.init();
}
If you want to remove the title, just add this style into your manifest file.
android:theme="#style/Theme.Black.NoTitleBar"
then the problem arises, notifying that you must use a derivative of an appcompat library. this is because you are using the support library v7, & on creating your project, an activity creates which doesn't extends as an Activity class, but ActionBarActivity class.
so, if you really want to use the support library, create the theme that you created under values, values-v11, values-v14 folders & apply your theme on your manifest.
else, change your ActionBarActivity class into Activity class & apply Theme.Black.NoTitleBar theme to your manifest.
hope that it helps.
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 just worked through the first introductory application for Android programming and noticed some strange behavior:
When the second Activity was generated it received the line:
getActionBar().setDisplayHomeAsUpEnabled(true);
in the onCreate function. As the tutorial points out, this line requires at least API level 11 and a guard for that and #SuppressLint("NewApi") should be added like so:
#SuppressLint("NewApi")
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);
// Make sure we're running on Honeycomb or higher to use ActionBar APIs
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}
The strange thing is that ignoring this advice and just hitting run worked fine at first but as soon as I made changes to the code it didn't work anymore and I got errors.
So when is lint actually active?
I've gone through several posts in stackoverflow but i'm still unable to get the answer to a simple question:
Is it possible to create a fullscreen app in Android 3.x onwards, with the actionbar?
Using the #android:style/Theme.Holo.Light.DarkActionBar
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
did not do the trick.
Using fullscreen theme, adding the actionbar through code did not do it either.
Does android not allow both to happen at the same time?
This works for me on all android versions ( from 4.0 up to 4.2 tested).
I do use actionbarsherlock, but that uses the native implementation on 4.0+.
#Override
protected void onResume() {
super.onResume();
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}, 1000);
}
What also seems to work is adding it in XML! So that's even better, because it doesn't incurr a show and hiding of the notificationarea. Haven't seen this code anywhere.
<style name="Theme.MyTheme" parent="#style/Theme.PICK_A_PARENT_THEME_LIKE_ACTIONBAR">
<item name="android:windowFullscreen">true</item>
</style>
Tested the XML with actionbarsherlock and a freshly created non-actionbarsherlock project.
Both work ok (on 4.0.3). Below is the fresh non-abs app.
Yes nearly.
What worked for me is:
In the Activity in the onCreate method before set Content View:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
requestWindowFeature(Window.FEATURE_ACTION_BAR);
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
and this is in the fragment part, but should also work in an activity:
getActivity().getActionBar().hide();
getView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
Some devices only dim the navigation buttons. The space of the navigation buttons con not be used, but there are a lot of other View Constants you can use.
kind regards
I have this problem with the Android ActionBarCompat project: On emulators with Android 4.0 the click on the app icon doesn't cause any onOptionsItemSelected event, whereas it works on all other OS versions.
Any input is greatly appreciated!
Are you seeing any touch feedback from the app icon? (Does it glow when you press it?)
Since many activities do not use the action bar home button, in apps that target API 14+ running on Android 4.0 it is disabled by default. (This is so that users don't try pressing it, see it glow, and wonder why nothing happened.) Apps that want to use this should call ActionBar#setHomeButtonEnabled(true).
We should probably revise the ActionBarCompat sample to surface this more clearly. One simple way to get you up and running would be to modify ActionBarHelperICS.java and add the following:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mActivity.getActionBar().setHomeButtonEnabled(true);
}
In an app where you want more control over turning this on and off you would want to make further changes.
I had this problem as well. This code did the trick for me:
public void onCreate(Bundle savedInstanceState) {
...
if (android.os.Build.VERSION.SDK_INT >= 11) {
//noinspection ConstantConditions
getActionBar().setHomeButtonEnabled(true);
} else {
getSupportActionBar().setHomeButtonEnabled(true);
}
}
Some extra info: minSdkVersion="7" targetSdkVersion="18". This is the LAUNCHER activity of my project, so it has no parent activity. Using setDisplayHomeAsUpEnabled(true) in other activities worked just fine.