0

When you start android app Main activity starts with white background and black header with your app name in left corner. Like this

How to wholly remove this (when app is started not to show this) and add custom loading progress bar or some logo to the screen?

carobnodrvo
  • 1,021
  • 1
  • 9
  • 32
  • 1
    It only looks like that because that's how you coded it. Are yo saying that you want a different starting activity? – Simon Jan 12 '13 at 17:15
  • Yes, I know it looks like that because it is coded like that. Yes I want different starting acrivity – carobnodrvo Jan 12 '13 at 17:26
  • To remove title bar: http://stackoverflow.com/questions/2445999/what-do-i-have-to-add-to-a-layout-to-hide-the-titlebar – IAmGroot Jan 12 '13 at 18:34

3 Answers3

1

How about creating a splash dialog with custom layout containing progress bar?

In your main activity do something like this

private SplashDialog mSplashDialog;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    showSplashScreen();
    setContentView(R.layout.yourmainlayout);        
}

protected void removeSplashScreen() {
    if (mSplashDialog != null) {
        mSplashDialog.dismiss();
        mSplashDialog = null;
    }
}

protected void showSplashScreen() {
    mSplashDialog = new SplashDialog(this, R.style.splash_dialog);
    mSplashDialog.setCancelable(false);
    mSplashDialog.show();
}

Create custom dialog

public class SplashDialog extends Dialog {
    private ProgressBar mProgressBar;

    public SplashDialog(Context context, int theme) {
        super(context, theme);
        setContentView(R.layout.splash_dialog);
        mProgressBar = (ProgressBar) findViewById(R.id.splash_progress);
    }

    public void setProgress(int progress) {
        mProgressBar.setProgress(progress);
    }
}

And add style to that will let dialog fill all screen.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="splash_dialog">
        <item name="android:padding">0dp</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowFrame">@null</item>
    </style>
</resources>

To change dialog's progress value call mSplashDialog.setProgress(int progress).

When your data is loaded call removeSplashScreen().

vasart
  • 6,692
  • 38
  • 39
  • Thanks this was useful! But still when I start application first it starts with [this](http://img585.imageshack.us/img585/7012/submenudemomainactivity.png) (it is there for very short time) and then it goes to splash screen. How to fully remove it ? – carobnodrvo Jan 13 '13 at 16:24
0

I think what you're looking for can be found here:

how to change the splash screen

William A Hopkins
  • 113
  • 1
  • 1
  • 6
0

What worked for me (since I don't have much load up on start actually I didn't need splash screen at all) is changing res/values/styles.xml :

<resources>
<color name="custom_theme_color">#000000</color>
<style name="AppTheme" parent="android:Theme.Light" >
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@color/custom_theme_color</item>
</style>
</resources>

It just start with black screen witch goes to full screen (after 1-2 sec) when it is all loaded. It looks very "profesional".

carobnodrvo
  • 1,021
  • 1
  • 9
  • 32