Android - Button in Dialog out of screen - android

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 :
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

Related

An elegant way to keep integrity of RelativeLayout when animating it?

Ok, so...
I know, there's been a real amount of questions about it, but it either didn't work, or was really fixed in a hard way. Oh, and that's my second day trying to do it, so please, accept my apologies about that and help me for Chet Haase's sake.
I have a button on top of a fragment, and a RecyclerView below it. When i press the button i want it to disappear and a new RelativeLayout with textfields to slide from the top.
I don't want to make it with animateLayoutChanges="true", cause it's not exactly what i was meant to do, and i want rather learn, than do it.
I tried to do it with widget.animate().translation... and the result was that one widget was just thrown in it's place when the rest of layout stood still. That's not what i meant to do.
I tried also to make an "new TranslateAnimation" since it has this "setFillAfter/Before" attribute... but that did not help me neither.
What i tried as well was to update the layout somehow adding to id margins and stuff (don't remember anymore, and i'm in work right now trying to figure it out, sorry) as it was described in some questions.
But none of that worked. I don't include code right now, cause i already tried to do it in some dozens of different ways.
Could you please tell me how to move a widget and make the rest of them to move with it? Is it possible?
I've already got it going once using setVisibility,animateLayoutChanges and animation combination, but that was massive and dirty as a baby duck.
Edit: oh, i almost forgot about it. Another problem is that when i animate/move a widget, only the rendering spod changes, but the real spot of it stays the same (ex. a onclicklistener)
Ok, me again.
I did it this way, that - let's say - i want to slide a button up and remove it.
So i animate it and all the other widgets (right, i can make a ViewGroup) up, put a listener on animation, and on "onAnimationEnd" i clear all the animations and set the visibility to GONE.
The animateLayoutChanges must be set to false
Still it's not what i wanted, so i'd be indebted to anyone who shows me another, better way.

Problems with android GridView

I am trying to display 2 columns of text in a GridView in android. I create a TextView for each cell of the grid. Everything seems to work well until the TextView tries to wrap the text to a second (or more) line. When this happens, sometimes the second line of text overwrites the next cell, rather than causing the cell to expand to fit the text. All I have to do to get the text to display properly is click one of the cells in the grid. This seems to cause the grid to repaint and then everything gets displayed properly. I have tried any number of things to fix this problem but nothing seems to help.
Is there some property that I have to set on the TextView or the GridView to allow the cells to expand to fit the text? Or is this just a glitch in GridView that I have to live with?
BTW, setting android:singleLine="true" prevents the word wrap and solves the problem but it isn't an ideal solution because I really don't want the text to be truncated.
At a quick glance, I'm afraid you might have to do a work-around. I know it seems like a glitch, but it may be more ideal to continue to have your views start a consistent location instead of constantly having them shift based on content. I know this is a pain for what you're trying to do, but keep in mind that this was designed for hopefully the best solution for any application. Anyway..
One workaround I would propose might be manually updating the beginning of the views that get written over. I know it's not exactly ideal, but you can figure out where to place it based on the properties of your view. This doesn't feel like a particularly elegant solution though, so I'll try to cook something better up and/or post sample code. Good Luck!

Placing a background picture and then having invisible touch (Android)

I am trying to make an application for android that is based on IPAD app. I want to keep the same look to the app, but I am not a very good designer. So I was wondering if it was possible to for me to crop say the entire header and then have an invisible button or something on top of portions of it. so the design would become a little bit easier. Also if that is possible how would I get the what ever the event item is going to be to overlap with a portion of the image if it has stranger orientation. (I think I could fake this by just moving it closest orientation and extending the size untill it fits, but it would be nice to find a better way.)
How would I go about that?
I tried making the button invisible, but that did not seem to work.
Thanks in advance
I got lost on your description. But if you want to make a button invisible, calling setVisibility(View.INVISIBLE); will not work, because it will not receive click events. You may want to set its color to transparent instead. try using:
button.setBackgroundColor(Color.TRANSPARENT);

Android: borders messed up on clickable view elements?

Hey folks. I have a strange problem with my EditView elements in an Android project I am working on. I make the view clickable in the xml file and put an action listener on it to launch a Uri. No problem there. What I'm finding though, is that the bottom of the view element disappears when the view is clickable. Below is a screenshot of what I mean. I added the bold/blue font to make the items stand out more, but it did that before adjusting the font as well.
Since I can't post an image here, I've linked to it below.
https://docs.google.com/leaf?id=0BxAyDSR7j2blZWYzYWViYjctM2E0Yi00NWFiLTllYmQtMTA3YWI3YTBhYmEw&hl=en
Turns out the problem is related to bolding the text. If I remove that, it does stop the problem. Looks like I need a better solution for pointing out clickable fields.

How to remove button line in Spinner?

I used a spinner to display a list:
At the bottom of the list, there is this grey line. How i can remove it programatically??
Thanks
That only seems to appear on the HTC Evo, I'm not sure why it's there, but it's not something that I know of a work around for. If you run the same app on another device it should be fine. Hopefully this is something that will be fixed in an update.

Categories

Resources