开发者

Android - Button in Dialog out of screen

开发者 https://www.devze.com 2023-03-08 16:54 出处:网络
I created an AlertDialog which is longer than the actual screen size. Within my AlertDialog I have a ListView which I can scroll down to see all 开发者_开发技巧items.

I created an AlertDialog which is longer than the actual screen size. Within my AlertDialog I have a ListView which I can scroll down to see all 开发者_开发技巧items.

My problem is with my Button: it is half displayed in the bottom of the screen.

Here is what it looks like :

Android - Button in Dialog out of screen

It seems that the button is not considered to be within the View. What should I do to keep the everything inbound?

Thank you. Leo


EDIT

As you said I might do something weird, I took a closer look at my code before posting you it.

I found that I didn't remove the builder.setMessage() that I used at the beginning. So after removing that line, it worked fine. Now the entire ListView is displayed!


As you said I might do something weird, I took a closer look at my code before posting you it.

I found that I didn't remove the builder.setMessage() that I used at the beginning. So after removing that line, it worked fine. Now the entire ListView is displayed!


Put a set height for your ListView so that the dialog isn't as tall. 80dp or so should be enough to show your button and enough of the ListView

0

精彩评论

暂无评论...
验证码 换一张
取 消