Android XML rounded clipped corners

后端 未结 3 512
-上瘾入骨i
-上瘾入骨i 2020-11-28 04:58

I\'ve setup a LinearLayout with the following drawable background:




        
3条回答
  •  迷失自我
    2020-11-28 05:42

    What your describing sounds like this:

    
       
       
    
    

    And the inner layout is pushing outside the rounded corners because it isn't rounded. You'll have to round the corners of your bitmap. If you have a repeating bitmap you'll want to look at defining a nine-patch drawable. Round your corners then define the portion of the graphic that can expand.

    http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape

    It'd be nice if we could just add a bitmap to the shape drawable and have that be applied as a skin over whatever shape we're drawing. And, I bet if you know what your doing you could create a Shape subclass that draws a bitmap, but that's not included in Android out of the box unfortunately.

提交回复
热议问题