Try making the Button and the EditText height "match_parent" (or 
"fill_parent") instead of "wrap_content".

I've run into this before and I think the Button and EditText aren't quite 
the same initial height when using "wrap_content". When the keyboard pops 
up, it might be pushing the Button up to the top of your LinearLayout 
because the Button is just a slight bit smaller than the EditText.

Steven
Studio LFP
http://www.studio-lfp.com


On Sunday, October 9, 2011 5:33:57 AM UTC-5, Alexander Bürger wrote:
>
> Dear Android experts,
>
> I have a little problem with a layout of an activity. Some elements are 
> moving in a strange way depending on the state of the on-screen keyboard.
>
> For testing, I made an Activity that only calls setContentView with this 
> layout:
>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
>      android:orientation="vertical" android:layout_width="fill_parent"
>      android:layout_height="fill_parent">
> <LinearLayout android:layout_height="wrap_content"
>          android:layout_width="match_parent" 
> android:id="@+id/topcontainer">
> <EditText android:id="@+id/editext"
>              android:layout_height="wrap_content" 
> android:layout_width="1dp"
>              android:layout_weight="1"/>
> <Button android:id="@+id/buttonright"
>              android:text="XY" android:layout_height="wrap_content"
>              android:layout_width="wrap_content"/>
> </LinearLayout>
> </LinearLayout>
>
> The problem is this: when starting to type in the EditText, the 
> on-screen keyboard pops up a "suggestion bar" with some possible 
> completions for the text typed in so far. When this suggestion bar is 
> showing, the Button is moving up by about one pixel on my device (Xperia 
> neo, 2.3.4), and when the suggestion bar is hidden again, the button 
> moves back into the original position.I have no idea why this happens. 
> To my eyes, the layout seems correct. I would be happy about any 
> suggestions on how to get rid of this problem.
>
> Thanks for your help,
>
> Alexander
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to