Archive for the ‘Dialog Box’ Category

Alert Dialog – Part 2

Friday, June 24th, 2011

In the last article we began styling an AlertDialog, but ran in to problems because Android does not apply text styles to AlertDialogs. In this article we’ll explore how we can overcome this problem.

(more…)

Alert Dialog – Part 1

Friday, June 17th, 2011

Recently there was a comment on the article Vector Drawables – part 3 asking if is possible to style an AlertDialog, rather than on an Activity, as is covered in that article. The simple answer is yes. However, it is not without it’s problems as we’ll see later.

(more…)

Vector Drawables – part 3

Tuesday, March 29th, 2011

In part 2 we got our basic dialog box look and feel working, but still had some tidying up to do.

The first things that we need to do it to make the dialog box title look a bit more like a dialog box title. We need to define a new drawable for the background of the title in res/drawable/dialog_title.xml:

(more…)

Vector Drawables – part 2

Monday, March 28th, 2011

In part 1 we set up a basic dialog box project, but it was badly in need of some styling and it didn’t bear much resemblance to a dialog box.

Let’s begin part 2 by making this actually appear in a centralised dialog-style window. To do this, we need to begin defining the “dialog” style that we declared earlier in res/values/styles.xml:

(more…)

Vector Drawables – part 1

Monday, March 28th, 2011

One of the building blocks of styling and themeing Android apps is understanding drawables. Drawables are graphic elements that come in two distinct types:

  • Bitmap Drawables – these are bitmap files such as PNG which are rendered as images by the OS. They can also be 9-patch bitmaps which enable the OS to anamorphically distort the image to fit a particular region.
  • Vector Drawables – These consist of XML files which contain some basic vector drawing command which the OS renders dynamically at runtime.

The main difference between the two types of drawable is that a single vector drawable will scale much better on a variety of different display types. Whereas you may need to produce multiple bitmap images to render well on hdpi, mdpi, and ldpi displays. The downside to vector drawables is twofold: firstly they will require more processing power to render,particularly gradients; secondly the drawing primitives are not as flexible as those in your favorite image manipulation software.

(more…)