How to create simple view separators

This will show you three ways to create nice looking view separators, to use between a row of buttons for example. The examples shows a LinearLayout with three buttons, that should get separators in between them. The third example may be the easiest one to implement, while the other ones gives you better customizability. Method one – Manually adding a view separator to the LinearLayout We can create a simple View that represents the separator, and just add it in between

» Read more

How to cut off too long lines of text in Lists with ellipsize

If you are using lists in your app, and some of the list items have too long text, making it wrap to several lines like item number three in the following image, then this trick will show you how to create better looking lists. Before, Text wrapping to two lines: Your custom list item xml layout file may look like this: <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android"

» Read more

How to align your TabHost at the bottom of the screen

This little tip will show you how to align your TabHost at the bottom of the screen in your Android app, like this: I assume you know how to use the TabHost the usual way (I might write a tutorial on that later). Say you are using your TabHost the following way: <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_

» Read more

The easiest way to create nice icons for Android apps

In this article I will show you a very easy way to create nice looking icon drawables you can use in your Android applications. Using this method we can easily skip through the difficult and time-consuming parts of creating icons. Yes, I know this method does not work for everyone, some Android developers have their own designer and so on, but for a small and simple app, this will definateley do! The problem Creating icons for Android apps may sound

» Read more

How to create Gradient Lines with Drawables in Android

This article will show you how to create simple gradient line separators to spice up the layout a little bit. We are going to create gradients like these: About Drawables First off, we are going to create a drawable. A drawable resource is graphics that can be drawn on the screen, it can be a couple of different things, here are some examples; Bitmaps – png, jpg or gif images Nine-Patch image – A png that can be stretched, to create buttons

» Read more

Stretching and Spanning layouts in Android

When I was working on my BF2Stats Android app, I had to find out how to place 2 widgets/layout elements on the same horizontal line, while keeping them stretched at the same time so they are filling the width of the screen. It took me a little research before I found a solution, so I will share two methods with you today. This tutorial will show you how to create layouts that stretches in the width. In Eclipse I

» Read more