Android XML rounded clipped corners -
i've setup linearlayout following drawable background:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="10dp" /> <solid android:color="#ccffffff"/> </shape>
the problem i'm having within linearlayout have linearlayout element sits @ bottom of it's parent. since doesn't have rounded corners corners extend past parents bottom left , right corners.
the drawable background on child linearlayout looks this:
<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/pedometer_stats_background" android:tilemode="repeat" />
the issue looks this: http://kttns.org/hn2zm on device non-clipping more apparent.
what best method accomplish clipping?
what describing sounds this:
<linearlayout android:shape="rounded"> <linearlayout android:background="@drawable/pedometer_stats_background"> </linearlayout> </linearlayout>
and inner layout pushing outside rounded corners because isn't rounded. you'll have round corners of bitmap. if have repeating bitmap you'll want @ defining nine-patch drawable. round corners define portion of graphic can expand.
http://developer.android.com/guide/topics/resources/drawable-resource.html#shape
it'd nice if add bitmap shape drawable , have applied skin on whatever shape we're drawing. and, bet if know doing create shape subclass draws bitmap, that's not included in android out of box unfortunately.
Comments
Post a Comment