android - Content area defined in 9 patch image doesn't work for custom view -


currently, have custom view barchart. wish have red shadowing effect on it. i'm using 9 patch image technique achieve so.

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:minheight="240dp"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:background="@drawable/card_background_red"     android:orientation="vertical"     android:padding="0dp" >      <org.yccheok.jstock.gui.charting.barchart         android:id="@+id/bar_chart"         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="1" />  </linearlayout> 

in custom view, there line of code, draw string @ end-y of view.

// drawing string @ end-y of barchart custom view. canvas.drawtext("2007", x0, getheight(), textpaint);  canvas.drawtext("2008", x1, getheight(), textpaint); 

i avoid custom view "touching" of red shadow, define content area of 9-patch, doesn't touch red shadow.

as can see, content area pretty stay away red shadow.

enter image description here

i thought drawn text never touch red shadow area, restrict content area (entire custom view?) stay away red shadow area. however, doesn't work.

enter image description here

am having wrong expectation on content area of 9 patch image? thought linear layout's "content" custom view barchart. hence, barchart shouldn't touching red shadow specific in 9 patch image. (http://www.shubhayu.com/android/9-patch-image-designers-vs-developers)

remove android:padding="0dp" linearlayout. overrides padding 9-patch.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -