legend and fieldset in android

前端 未结 1 2017
旧时难觅i
旧时难觅i 2020-12-09 12:50

I want to know if it\'s possible in android to do a form like that :

\"enter

A

1条回答
  •  忘掉有多难
    2020-12-09 13:02

    I have managed to get a frame with title using the following technique.

    1. Use FrameLayout for the overall layout.

    2. Inside add another layout for your main content - this can be anything. For the background of this layout, use a custom XML drawable with stroke to draw the frame. Make sure to add margins in this layout, especially marginTop, as you need some room to display the title of the frame. Also add some padding to make it look nicer.

    3. Use TextView with opaque background and some paddings as the title. Set marginLeft on it to a reasonable value to offset the title from the left.

    Here's my XML for this:

    
    
    
        
        
    
            
    
        
    
        
        
    
    
    

    When executed, I get this on the app:

    enter image description here

    Feel free to tweak the margins/paddings to align the title the way you need.

    0 讨论(0)
提交回复
热议问题