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

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

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

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

解決済

1回答

1105閲覧

Android Studio レイアウトについて

boc20

総合スコア26

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

0グッド

0クリップ

投稿2017/01/31 04:34

編集2017/01/31 06:53

###前提・実現したいこと
GridViewを使用しているのですが画面を縁取る様に隙間ができるのですがレイアウトを画面いっぱいにする方法を教えていただきたいです。
画像を添付しています。イメージ説明

###発生している問題・エラーメッセージ

特にないです

###補足情報(言語/FW/ツール等のバージョンなど)
Android Studio 2.2.3
Android API19
OS Windows10
使用機種Xperiaz1f(SO-0

###該当のソースコード

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:orientation="vertical" tools:context="com.example.owner.interface1.MainActivity"> <HorizontalScrollView android:layout_width="352dp" android:layout_height="352dp"> <GridLayout android:layout_width="match_parent" android:layout_height="match_parent" android:columnCount="50" android:rowCount="14"> <TextView android:layout_width="352dp" android:layout_height="49.142857dp" android:layout_column="0" android:layout_row="0" android:layout_columnSpan="14" android:background="#000" android:text="○○○○年○○月" android:gravity="center" android:textSize="11pt"/> <TextView android:layout_height="24.57142dp" android:layout_width="49.142857dp" android:layout_column="0" android:layout_row="1" android:gravity="center" android:text="日"/> <TextView android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="1" android:layout_row="1" android:background="#f00"/> <TextView android:layout_width="49.142857dp" android:layout_height="24.57142dp" android:layout_column="2" android:layout_row="1" android:text="月" android:gravity="center"/> <TextView android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="3" android:layout_row="1" android:background="#f00"/> <TextView android:layout_height="24.57142dp" android:layout_width="49.142857dp" android:layout_column="4" android:layout_row="1" android:text="火" android:gravity="center"/> <TextView android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="5" android:layout_row="1" android:background="#f00"/> <TextView android:layout_width="49.142857dp" android:layout_height="24.57142dp" android:layout_column="6" android:layout_row="1" android:text="水" android:gravity="center"/> <TextView android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="7" android:layout_row="1" android:background="#f00"/> <TextView android:layout_height="24.57142dp" android:layout_width="49.142857dp" android:layout_column="8" android:layout_row="1" android:text="木" android:gravity="center"/> <TextView android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="9" android:layout_row="1" android:background="#f00"/> <TextView android:layout_height="24.57142dp" android:layout_width="49.142857dp" android:layout_column="10" android:layout_row="1" android:text="金" android:gravity="center"/> <TextView android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="11" android:layout_row="1" android:background="#f00"/> <TextView android:layout_height="24.57142dp" android:layout_width="49.142857dp" android:layout_column="12" android:layout_row="1" android:text="土" android:gravity="center"/> <TextView android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="13" android:layout_row="1" android:background="#f00"/> <Button android:layout_width="49.142857dp" android:layout_height="49.142857dp" android:layout_column="0" android:layout_row="2"/> <Button android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="1" android:layout_row="2" android:background="#f00"/> <Button android:layout_height="49.142857dp" android:layout_width="49.142857dp" android:layout_column="2" android:layout_row="2"/> <Button android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="3" android:layout_row="2" android:background="#f00"/> <Button android:layout_height="49.142857dp" android:layout_width="49.142857dp" android:layout_column="4" android:layout_row="2"/> <Button android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="5" android:layout_row="2" android:background="#f00"/> <Button android:layout_width="49.142857dp" android:layout_height="49.142857dp" android:layout_column="6" android:layout_row="2"/> <Button android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="7" android:layout_row="2" android:background="#f00"/> <Button android:layout_height="49.142857dp" android:layout_width="49.142857dp" android:layout_column="8" android:layout_row="2"/> <Button android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="9" android:layout_row="2" android:background="#f00"/> <Button android:layout_width="49.142857dp" android:layout_height="49.142857dp" android:layout_column="10" android:layout_row="2"/> <Button android:layout_height="24.57142dp" android:layout_width="1dp" android:layout_column="11" android:layout_row="2" android:background="#f00"/> <Button android:layout_height="49.142857dp" android:layout_width="49.142857dp" android:layout_column="12" android:layout_row="2" /> </GridLayout> </HorizontalScrollView> </LinearLayout>

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

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

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

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

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

aja

2017/01/31 06:27

共通の土台としてコードを出せば明確にお互い伝わります。GridViewではないこともありますし。画像もありません。
boc20

2017/01/31 06:48

付けるのを忘れてました。よろしくお願いします。
guest

回答1

0

ベストアンサー

コードの最初のLinearLayout定義で
マージンを取っているからです。
削除すればいいでしょう

android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin"

それからこれはGridViewをではありませんGridLayoutです
コードがなければ全然違う回答が返ってきてたでしょうね

投稿2017/01/31 06:58

aja

総合スコア3733

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

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

boc20

2017/01/31 07:03

勘違いしていました。GridLayoutですね この記述にこのような意味があるとは知りませんでした。 回答ありがとうございます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問