2017-02-23 3 views
0

私の問題は、ボタンサイズの変更ということである。テキストを入力するときにボタンのサイズが変わる、どうすればそれを止めることができますか?私はボタンで複数のテキストを入力すると

私のGridLayout:

:私はボタンで複数のテキストを入力すると

click me

問題が発生

click me

マイXML:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" android:layout_width="match_parent" 

    android:layout_height="match_parent"> 

    <GridLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <Button 
      android:text="Buttonnnnnnnnnnn" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_columnWeight="1" 
      android:layout_rowWeight="1" 
      android:id="@+id/button1" /> 

     <Button 
      android:text="Button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_columnWeight="1" 
      android:layout_rowWeight="1" 
      android:id="@+id/button2" /> 

     <Button 
      android:text="Button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_columnWeight="1" 
      android:layout_rowWeight="1" 
      android:id="@+id/button3" 
      android:layout_row="1" 
      android:layout_column="1" /> 
     <Button 
      android:text="Button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_columnWeight="1" 
      android:layout_rowWeight="1" 
      android:id="@+id/button4" 
      android:layout_row="1" 
      android:layout_column="0" /> 
     <Button 
      android:text="Button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_columnWeight="1" 
      android:layout_rowWeight="1" 
      android:id="@+id/button5" 
      android:layout_row="2" 
      android:layout_column="0" /> 
     <Button 
      android:text="Button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_columnWeight="1" 
      android:layout_rowWeight="1" 
      android:id="@+id/button6" 
      android:layout_row="2" 
      android:layout_column="1" /> 

    </GridLayout> 
</LinearLayout> 

android:layout_width="match_parent" 
android:layout_height="match_parent" 

android:layout_width="wrap_content" 
android:layout_height="wrap_content" 

を変更すると、

動作しない私は、ボタンのサイズを変更することを望んでいません。どうやってやるの?

答えて

0

layout:heightlayout:widthを一定の 'xdp'にしてください。コンテンツをラップすると、テキストサイズに合わせて自動的に調整され、テキスト全体がラップされるためです。

0

GridLayoutを使用して、幅を使用して幅と高さを管理しているため、ボタンサイズに0dpを設定できます。

関連する問題