4

I want to do intricate borders in my android popups like I see on the ipad.

example:

What I see here is a thick gradient blue border with alpha transparency at the top. As well as a drop shadow extending further from the background.

In android I've tried using shape objects for doing semi intricate backgrounds. This is just a white border.

<?xml version="1.0" encoding="utf-8"?>
<shape
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="rectangle">
   <solid
       android:color="#303030"/>
 <stroke
    android:width="1dip"
    android:color="#ffffff"
    />
  </shape>   

but these are limited in that they can't accept images as variables here. I guess it would be awfully complex to do these kind of borders in Android. Like perhaps make a relativelayout or tables with the views having the pieces of the background. Kind of like an HTML layout.

Is there a better way to do complex and intricate borders in android? I'd like to make a polished skin kind of like how iOS has that one default that has a uniform aesthetic for iOS.

Community
  • 1
  • 1
CQM
  • 36,672
  • 69
  • 214
  • 357
  • 2
    You'd likely need to use 9-patch images to create borders like that. I'd take a look at creating those if you want to dive into that level of custimization of the UI – dymmeh Dec 07 '11 at 21:34

1 Answers1

5

Yes it is complicated, but the good thing is you can reuse the layout you draw for all the components in your application, so you basically only have to do it once for each "style".

Here are a few pointers in which I've learned a lot about styling Android:

http://blog.donnfelker.com/2011/08/01/android-rounded-corners-with-a-beveldrop-shadow/

http://blog.stylingandroid.com/archives/378

Custom ImageView with drop shadow

Android: Using linear gradient as background looks banded

And here is the 9-patch image I use for drop-shadow (I think it's taken from one of the posts above)

alt text

Community
  • 1
  • 1
Guillaume
  • 21,938
  • 14
  • 54
  • 69