2012-12-23 32 views
0

後,我有我的佈局按鈕的問題。每當我添加一個按鈕,文本就會在按鈕的中心之後開始。的Android按鈕文本啓動中心按鈕

這就是我的意思是:

enter image description here

林用Relativelayout,但如果我用Linearrelativetable它這麼想的關係。 寬度和高度被設置爲wrap_content。

我對任何形式的幫助非常感激。

+0

你在工作? CSS? Android的?認真需要更多的細節 – cjds

+0

張貼你的xml,希望你沒有在Android中插入空間:文字 –

+0

Android。 @Gaurav爲什麼我會那樣做? – fillevoss

回答

1

試試這個機器人:重力= 「左」

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context=".MainActivity" > 

<Button 
    android:id="@+id/button" 
    android:layout_width="fill_parent" 
    android:layout_height="200dp" 
    android:gravity="left" 
    android:text="Button" /> 

+1

非常感謝我沒有想到這一點!此外,這似乎只是在xml文件的圖形預覽中出現問題。調試時,它似乎可以很好地工作,不管有沒有重力,但是很煩人。 – fillevoss

0

當我有這個問題,這是Eclipse的GUI設計的問題。 Eclipse重啓應該有幫助。