Android how to make complex backgrounds and borders

I want to make complex borders in my Android popups, as I see on the iPad.

example:

Here I see a thick gradient blue frame with alpha transparency at the top. And also a shadow from the background.

In Android, I tried to use form objects to create 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 they are limited in that they cannot accept images as variables here. I think it would be very difficult to make such boundaries in Android. How to possibly make a relative layout or tables with views that have slices of background. It seems like an HTML layout.

Is there a better way to make complex and complex borders in Android? I would like to make a polished skin like iOS has the only default value that has the same aesthetics for iOS.

+4
source share
1 answer

Yes, it’s difficult, but it’s good that you can reuse the layout that you draw for all components of your application, so you basically only need to do this once for each β€œstyle”.

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

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

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

Custom ImageView with Shadow Print

Android: using linear gradient as background image

And here is the image with 9 patches that I use for drop-shadow (I think this is taken from one of the messages above)

alt text

+5
source

Source: https://habr.com/ru/post/1385219/


All Articles