2011-08-01 12 views
4

私のアンドロイドアプリには、投票写真用のボタンがあります。ユーザーがこのボタンを選択すると、このボタンのテキストが「あなたの投票に感謝しました」となり、彼が前に投票した写真を見ると、Buttonには「あなたはこの写真に投票しました」というテキストが表示されます...問題それはこのように見えるということです:http://i55.tinypic.com/t4z3vl.pngボタンにテキストを合わせる方法は?

私は誰にでも私はボタンにテキストを合わせることができますか?

ご了承ください。前もって感謝します。私はこの持っているXMLで

Button

+0

をこの行を追加し あなたはすべてのボタンの上部を揃えたいと思いますか?より多くのスペースを取るようにしますか?またはクリップのテキスト? –

+0

私は投票のためのボタンが同じレベルでボタンと次のボタンと同じ行にあることを望みます。そして、すべてのテキストをボタンで確認してください。 – Gabrielle

+0

2番目のボタンの使用** android:width ** android:layout_width = "wrap_content" – Hanry

答えて

5

私はあなたが何をすべきかをしたいですか、あなたのレイアウトに

LinearLayout android:baselineAligned="false" 
+0

私はこれを持っている:http://i52.tinypic.com/ifa987.jpg私はこれを得る:http://i53.tinypic.com/2wbt121.pngそれは良いが、okではない – Gabrielle

+0

@ Gabrielle割り当てのレイアウト彼らにウェイトはあなたを助けるかもしれない –

+0

あなたは正しいです。作品:D ...ありがとう – Gabrielle

3

使用"wrap_content"をこんにちはあなたは、各画面の精のスタイルを持っている場合、それはあなたのを解決するかもしれないこれらのhttp://developer.android.com/guide/practices/screens_support.htmlを見てみましょう問題。 :D

+0

私はlayout_heightのwrap_contentを持っています – Gabrielle

+0

あなたにxmlを見せてください! –

+0

xmlで質問を編集しました。 – Gabrielle

1

layout_heightプロパティの

<LinearLayout android:layout_width="fill_parent" 
     android:layout_height="wrap_content" android:layout_below="@id/imagetitle" 
     android:orientation="horizontal"> 
     <Button android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Previous" android:id="@+id/previous" /> 
     <Button android:layout_width="185dip" android:layout_height="wrap_content" 
      android:text="Vote for this picture" android:id="@+id/vote" /> 
     <Button android:layout_width="wrap_content" 
      android:layout_height="wrap_content" android:text="Next" android:id="@+id/next" /> 
    </LinearLayout> 
関連する問題