android - Button moved down when I put a long text on it -


i explain think image explains issue better words ever do:

example

and here's layout.

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" >  <include     android:id="@+id/include1"     android:layout_width="fill_parent"     android:layout_height="0dp"     android:layout_weight="1"     layout="@layout/action_bar" />   <scrollview     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:layout_gravity="top"     android:padding="8dip" >      <linearlayout         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:orientation="vertical" >          <tablerow             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:layout_gravity="center" >              <button                 android:id="@+id/button1"                 android:layout_width="150dip"                 android:layout_height="150dip"                 android:text="this short text" />              <button                 android:id="@+id/button2"                 android:layout_width="150dip"                 android:layout_height="150dip"                 android:text="this long text show how button moved when has long text on it" />         </tablerow>          <linearlayout             android:layout_width="fill_parent"             android:layout_height="wrap_content" >              <button                 android:id="@+id/button3"                 android:layout_width="150dip"                 android:layout_height="150dip"                 android:text="button" />              <button                 android:id="@+id/button4"                 android:layout_width="150dip"                 android:layout_height="150dip"                 android:text="button" />         </linearlayout>     </linearlayout> </scrollview> 

i had same issue. reason is, default value of baselinealigned true, button moved down have text on same base line. setting value on linearlayout false sloves problem.

android:baselinealigned="false" 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -