Posts tagged ui
How to add a splash screen to your android application in under 5 minutes
3Adding a splash screen to your application is a quick and easy way to make it look more well rounded, complete, and more professional, it can also serve as a useful distraction whereby you have an extra few seconds to initialise your application components before displaying them to the user.
In this post I’ll show you how to quickly and easily add a splash screen into your application, I’ll also show you how you can create an option whereby users may disable or enable the splash screen for subsequent launches of your application. I’ll also post up my sample code freely on Github so you can checkout what I’ve done and use as you please.
Converting dp to pixels in android
0Sometimes in android you have to deal with pixels, which can often be awkward, such as view.setPadding(int, int, int, int). Obviously this is not ideal as pixel ratings vary from device to device, nonetheless there is a work around for this
Simply come up with the value you want in dip (density independent pixels), such as 10, and then convert into pixels using the display metrics of the device you’re working on. This will ensure that when the conversion runs, it’ll always scale to the device the application is running on.
float sizeInDip = 10f; int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, sizeInDip, getResources().getDisplayMetrics());
Enjoy!
How to remove the default grey title bar on android apps
0Fed up of the default title bar on your android applications?
We can get rid of that easy, either use the following in your activities to do it :
requestWindowFeature(Window.FEATURE_NO_TITLE);
Or, the way I prefer, disable it application wide by slipping the following into the AndroidManifest.xml file :
android:theme="@android:style/Theme.NoTitleBar"



