質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
XML

XMLは仕様の1つで、マークアップ言語群を構築するために使われています。

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Q&A

解決済

1回答

2290閲覧

GridLayoutが小さいインチ数の端末だと正しく表示されない

na3kick

総合スコア12

XML

XMLは仕様の1つで、マークアップ言語群を構築するために使われています。

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

0グッド

0クリップ

投稿2016/09/24 13:36

編集2016/09/24 13:41

####環境
AndroidStudio2.1
Minimum SDK API21

####困っていること
電卓アプリを作っています。

xml

1<?xml version="1.0" encoding="utf-8"?> 2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:tools="http://schemas.android.com/tools" 4 android:layout_width="match_parent" 5 android:layout_height="match_parent" 6 android:orientation="vertical" 7 tools:context="com.example.Calc.MainActivity"> 8 9 <TextView 10 android:id="@+id/display_input" 11 style="@style/CalculatorStyle.Display" 12 android:text="" /> 13 14 <TextView 15 android:id="@+id/display_result" 16 style="@style/CalculatorStyle.Display" 17 android:text="" /> 18 19 <GridLayout 20 android:layout_width="match_parent" 21 android:layout_height="match_parent" 22 android:columnCount="5" 23 android:rowCount="4"> 24 25 <Button 26 android:id="@+id/digit_7" 27 android:layout_width="wrap_content" 28 android:layout_height="wrap_content" 29 android:layout_column="0" 30 android:layout_columnWeight="1" 31 android:layout_row="0" 32 android:layout_rowWeight="1" 33 android:text="7" 34 35 android:textSize="32sp" /> 36 37 <Button 38 android:id="@+id/digit_4" 39 android:layout_width="wrap_content" 40 android:layout_height="wrap_content" 41 android:layout_column="0" 42 android:layout_columnWeight="1" 43 android:layout_row="1" 44 android:layout_rowWeight="1" 45 android:text="4" 46 47 android:textSize="32sp" /> 48 49 <Button 50 android:id="@+id/digit_1" 51 android:layout_width="wrap_content" 52 android:layout_height="wrap_content" 53 android:layout_column="0" 54 android:layout_columnWeight="1" 55 android:layout_row="2" 56 android:layout_rowWeight="1" 57 android:text="1" 58 android:textSize="32sp" /> 59 60 <Button 61 android:id="@+id/dot" 62 android:layout_width="wrap_content" 63 android:layout_height="wrap_content" 64 android:layout_column="0" 65 android:layout_columnWeight="1" 66 android:layout_row="3" 67 android:layout_rowWeight="1" 68 android:text="" 69 70 android:textSize="32sp" /> 71 72 <Button 73 android:id="@+id/digit_8" 74 android:layout_width="wrap_content" 75 android:layout_height="wrap_content" 76 android:layout_column="1" 77 android:layout_columnWeight="1" 78 android:layout_row="0" 79 android:layout_rowWeight="1" 80 android:text="8" 81 82 android:textSize="32sp" /> 83 84 <Button 85 android:id="@+id/digit_5" 86 android:layout_width="wrap_content" 87 android:layout_height="wrap_content" 88 android:layout_column="1" 89 android:layout_columnWeight="1" 90 android:layout_row="1" 91 android:layout_rowWeight="1" 92 android:text="5" 93 android:textSize="32sp" /> 94 95 <Button 96 android:id="@+id/digit_2" 97 android:layout_width="wrap_content" 98 android:layout_height="wrap_content" 99 android:layout_column="1" 100 android:layout_columnWeight="1" 101 android:layout_row="2" 102 android:layout_rowWeight="1" 103 android:text="2" 104 android:textSize="32sp" /> 105 106 <Button 107 android:id="@+id/digit_0" 108 android:layout_width="wrap_content" 109 android:layout_height="wrap_content" 110 android:layout_column="1" 111 android:layout_columnWeight="1" 112 android:layout_row="3" 113 android:layout_rowWeight="1" 114 android:text="0" 115 android:textSize="32sp" /> 116 117 <Button 118 android:id="@+id/digit_9" 119 android:layout_width="wrap_content" 120 android:layout_height="wrap_content" 121 android:layout_column="2" 122 android:layout_columnWeight="1" 123 android:layout_row="0" 124 android:layout_rowWeight="1" 125 android:text="9" 126 android:textSize="32sp" /> 127 128 <Button 129 android:id="@+id/digit_6" 130 android:layout_width="wrap_content" 131 android:layout_height="wrap_content" 132 android:layout_column="2" 133 android:layout_columnWeight="1" 134 android:layout_row="1" 135 android:layout_rowWeight="1" 136 android:text="6" 137 android:textSize="32sp" /> 138 139 <Button 140 android:id="@+id/digit_3" 141 android:layout_width="wrap_content" 142 android:layout_height="wrap_content" 143 android:layout_column="2" 144 android:layout_columnWeight="1" 145 android:layout_row="2" 146 android:layout_rowWeight="1" 147 android:text="3" 148 android:textSize="32sp" /> 149 150 <Button 151 android:id="@+id/division" 152 android:layout_width="wrap_content" 153 android:layout_height="wrap_content" 154 android:layout_column="3" 155 android:layout_columnWeight="1" 156 android:layout_row="0" 157 android:layout_rowWeight="1" 158 android:text="÷" 159 android:textSize="24sp" /> 160 161 <Button 162 android:id="@+id/multiplication" 163 android:layout_width="wrap_content" 164 android:layout_height="wrap_content" 165 android:layout_column="3" 166 android:layout_columnWeight="1" 167 android:layout_row="1" 168 android:layout_rowWeight="1" 169 android:text="×" 170 android:textSize="24sp" /> 171 172 <Button 173 android:id="@+id/subtraction" 174 android:layout_width="wrap_content" 175 android:layout_height="wrap_content" 176 android:layout_column="3" 177 android:layout_columnWeight="1" 178 android:layout_row="2" 179 android:layout_rowWeight="1" 180 android:text="" 181 android:textSize="24sp" /> 182 183 <Button 184 android:id="@+id/addition" 185 android:layout_width="wrap_content" 186 android:layout_height="wrap_content" 187 android:layout_column="3" 188 android:layout_columnWeight="1" 189 android:layout_row="3" 190 android:layout_rowWeight="1" 191 android:text="+" 192 android:textSize="24sp" /> 193 194 <Button 195 android:id="@+id/delete" 196 android:layout_width="wrap_content" 197 android:layout_height="wrap_content" 198 android:layout_column="4" 199 android:layout_columnWeight="1" 200 android:layout_row="0" 201 android:layout_rowWeight="1" 202 android:text="DEL" 203 android:textSize="24sp" /> 204 205 <Button 206 android:id="@+id/equal" 207 android:layout_width="wrap_content" 208 android:layout_height="wrap_content" 209 android:layout_column="4" 210 android:layout_columnWeight="1" 211 android:layout_row="3" 212 android:layout_rowWeight="1" 213 android:text="=" 214 android:textSize="24sp" /> 215 216 217 </GridLayout> 218 219</LinearLayout>


Nexus7、Nexus10のような端末では表示されるのですが

Nexus4、Nexus5Xでは、きちんと表示されません。
解決方法がわかる方は教えて下さい。よろしくお願い致します。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

Buttonのlayout_widthとlayout_heightを0dpにすれば表示されました。

投稿2016/09/25 02:41

na3kick

総合スコア12

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問