How to get gravity 'bottom' working on a drawable in xml

前端 未结 7 1493
南方客
南方客 2021-02-12 15:41

I have a simple aim. I want a light grey background on my FrameLayout with a black dividing line underneath it (only undernearth, not all around). So far I have this:

<         


        
7条回答
  •  我寻月下人不归
    2021-02-12 16:20

    I'd recommend using a nine-patch image for this - here's an example that should do the job:

    Example nine-patch image

    (It's only tiny but it is there!)

    If you place this in your drawable folder and set your FrameLayout's background to it then you should get the desired result. The content will go in the grey area and the #010101 pixel will be stretched horizontally to form a line at the bottom. Just make sure to keep the .9.png extension to ensure it gets loaded as a nine-patch.

    Hope that helps you

提交回复
热议问题