I added a button in the UI, which is the default height
android: id = "@ + id/button1"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: layout_alignParentTop = "true"
android: layout_toRightOf = "@ + id / preview_btn"
android: text = "Button" />
At this point, it is the default height, when I add a background for:
android: background = "@ drawable / photo_select_preview_btn"
photo_select_preview_btn is a resource file:
- android: drawable = "@ drawable / photo_select_preview_btn_disable" />
Resource file is three 9.png picture, then find the button is hold high:
After solving the reasons why a 9.png add a background, the button stays high it was, how he would not be supporting high?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
android: layout_height = "wrap_content" in
"Wrap_content" is to control the height or width of the controls in the content wrap will change with the size of the content changes, change the background image height, the height of the button will change, if you want a fixed height, you can set a specific values, such as to:
android: layout_height = "200px"
Reply:
Upstairs positive solution, or the height of the image can be piecemeal.
Reply:
Thank you, has been resolved, I put the picture in the wrong folder, my phone is 240 dpi, should be placed under the drawable-hdpi, but wrong picture on the drawable-mdpi, resulting in a stretched picture . .
No comments:
Post a Comment