android - round rect border for layouts -


in application i'm going use lot of layout "borders" simple rounded rectangle. test how created .png file transparent background:

enter image description here

i set image layout background. problem need different proportions other layouts , waste of time create such images in photoshop layouts.

the questions: how can same android api (maybe xml shape) allow rectangle stretched dimension , still remain sharp?

you can use drawable

have bkg.xml in drawable folder

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"        android:shape="rectangle">     <solid android:color="#ffffff"/>     <stroke         android:width="3dp"         android:color="#0fecff"/>     <padding         android:bottom="5dp"         android:left="5dp"         android:right="5dp"         android:top="5dp"/>     <corners         android:bottomleftradius="7dp"         android:bottomrightradius="7dp"         android:topleftradius="7dp"         android:toprightradius="7dp"/> </shape> 

then set background

  android:background="@drawable/bkg" //to required view 

snasp shot of graphical editor when set drawable background textview.

enter image description here


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -