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

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

新規登録して質問してみよう
ただいま回答率
85.50%
Android Debug Bridge(ADB)

Android Debug Bridge(ADB)は、接続された端末をAndroidエミュレータもしくはAndroidのインスタンスにアクセスに接続するためのツール。端末アクションをサポートし、様々なコマンドの実行の際に用いられるUnixシェルへのアクセスを提供します。

Android Studio

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

Kotlin

Kotlinは、ジェットブレインズ社のアンドリー・ブレスラフ、ドミトリー・ジェメロフが開発した、 静的型付けのオブジェクト指向プログラミング言語です。

Android Emulator

Android EmulatorはアンドロイドのOSで起動しているアンドロイドのデバイスの機能をシミュレートするソフトウェアです。Emulatorは開発者に複数の違う設定を持ったデバイスを必要とすることなくアプリケーションを開発しテストすることが可能になります。

Q&A

解決済

2回答

2032閲覧

ANDROID STUDIO KOTLIN メニューが消えたけど消えただけでwebが上にいかない

退会済みユーザー

退会済みユーザー

総合スコア0

Android Debug Bridge(ADB)

Android Debug Bridge(ADB)は、接続された端末をAndroidエミュレータもしくはAndroidのインスタンスにアクセスに接続するためのツール。端末アクションをサポートし、様々なコマンドの実行の際に用いられるUnixシェルへのアクセスを提供します。

Android Studio

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

Kotlin

Kotlinは、ジェットブレインズ社のアンドリー・ブレスラフ、ドミトリー・ジェメロフが開発した、 静的型付けのオブジェクト指向プログラミング言語です。

Android Emulator

Android EmulatorはアンドロイドのOSで起動しているアンドロイドのデバイスの機能をシミュレートするソフトウェアです。Emulatorは開発者に複数の違う設定を持ったデバイスを必要とすることなくアプリケーションを開発しテストすることが可能になります。

0グッド

0クリップ

投稿2019/11/22 06:43

編集2019/11/22 15:18

#追記

イメージ説明

<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/text_login" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:textAlignment="center" android:textSize="20sp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <WebView android:id="@+id/webview_login" android:layout_width="match_parent" android:layout_height="match_parent" /> </androidx.constraintlayout.widget.ConstraintLayout>

お世話になります。
画像の矢印の部分をご覧ください。
イメージ説明

なんとか上部矢印のメニューを消す事に成功しました。確かに消す事には成功したのですが余白が生まれてしまいます。
Googleのホームページなのでわかりずらいですが、うっすら矢印の内部の色は違います。矢印より内側はGoogleのホームページが表示されているわけではありません。つまりWEBVIEWではありません。

メニューの余白を削除した以下の図のようにWebを全体に表示させるためには
どのようにコードを記載すればいいのでしょうか?以下の図をご覧ください。余白がなくきれいにWEBが表示されています。このような実装がしたいです。

#実装したいweb表示画面レイアウト

イメージ説明

#ためしたこと
onWindowFocusChanged(hasFocus: Boolean)
hideSystemUI
を設定しMAINACTIVITY.KTに追記しメニューを削除しました。

package com.hoge.spaceapprication import android.os.Bundle import android.util.Log import android.view.View import android.webkit.WebView import android.webkit.WebViewClient import com.google.android.material.bottomnavigation.BottomNavigationView import androidx.appcompat.app.AppCompatActivity import androidx.navigation.findNavController import androidx.navigation.ui.AppBarConfiguration import androidx.navigation.ui.setupActionBarWithNavController import androidx.navigation.ui.setupWithNavController class MainActivity : AppCompatActivity() { var mWebView: WebView? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) supportActionBar!!.hide() val navView: BottomNavigationView = findViewById(R.id.nav_view) val navController = findNavController(R.id.nav_host_fragment) val appBarConfiguration = AppBarConfiguration( setOf( R.id.navigation_login, R.id.navigation_home, R.id.navigation_search, R.id.navigation_dashboard, R.id.navigation_notifications ) ) setupActionBarWithNavController(navController, appBarConfiguration) navView.setupWithNavController(navController) // val myWebView: WebView = findViewById(R.id.webview) // myWebView.loadUrl("https://www.google.com") } override fun onWindowFocusChanged(hasFocus: Boolean) { super.onWindowFocusChanged(hasFocus) hideSystemUI() } private fun hideSystemUI(){ val decorView = window.decorView decorView.systemUiVisibility = ( View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN ) window.decorView.setOnSystemUiVisibilityChangeListener { visibility -> // Note that system bars will only be "visible" if none of the // LOW_PROFILE, HIDE_NAVIGATION, or FULLSCREEN flags are set. if (visibility and View.SYSTEM_UI_FLAG_FULLSCREEN == 0) { Log.d("debug","The system bars are visible") } else { Log.d("debug","The system bars are NOT visible") } } } }

宜しくお願いします。

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

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

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

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

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

退会済みユーザー

退会済みユーザー

2019/11/22 12:23

画面のレイアウトも貼ってください
退会済みユーザー

退会済みユーザー

2019/11/22 14:11

webviewのレイアウトは全画面に配置されてます。
退会済みユーザー

退会済みユーザー

2019/11/22 14:45

それをこのページを見た人はどう判断すればいいんですか?
退会済みユーザー

退会済みユーザー

2019/11/22 15:16

いま張りますね
退会済みユーザー

退会済みユーザー

2019/11/22 15:18 編集

張りましたのでお手数をおかけしますが確認・判断しご教示頂きますようお願いします。
退会済みユーザー

退会済みユーザー

2019/11/23 03:39

activity_mainの方のレイアウトももらえますか? なんかActionBarみたいなものが出てるっぽいけど判別できないので
退会済みユーザー

退会済みユーザー

2019/11/23 05:00

以下です。 <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="?attr/actionBarSize"> <!--android:background="@drawable/background" <WebView android:id="@+id/webview" android:layout_width="match_parent" android:layout_height="match_parent" /> <com.google.android.material.bottomnavigation.BottomNavigationView android:id="@+id/nav_view" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="0dp" android:layout_marginEnd="0dp" android:background="?android:attr/windowBackground" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:menu="@menu/bottom_nav_menu" /> <fragment android:id="@+id/nav_host_fragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="match_parent" app:defaultNavHost="true" app:layout_constraintBottom_toTopOf="@id/nav_view" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" app:navGraph="@navigation/mobile_navigation" /> </androidx.constraintlayout.widget.ConstraintLayout>
退会済みユーザー

退会済みユーザー

2019/11/23 07:29

質問文に書いてほしかったですが… ConstraintLayoutの↓これが悪さしてると思います。 > android:paddingTop="?attr/actionBarSize" これ消してしまえば上の空白はなくなるのでは?
退会済みユーザー

退会済みユーザー

2019/11/23 07:37

android:paddingTop="?attr/actionBarSize" を消しても上の空白はなくなりませんでした。
退会済みユーザー

退会済みユーザー

2019/11/23 07:38

再起動したらなおりました。yukke_さんいつもありがとう!
退会済みユーザー

退会済みユーザー

2019/11/23 09:38

回答の方に書いておきました。
退会済みユーザー

退会済みユーザー

2019/11/23 10:01

アンサー変更できないようです。。
退会済みユーザー

退会済みユーザー

2019/11/23 12:38

外してつけ直すでどうでしょう そちらから見れば回答の右下に「ベストアンサーを外す」があるので
guest

回答2

0

Xml

1<androidx.constraintlayout.widget.ConstraintLayout 2 (省略) 3 android:paddingTop="?attr/actionBarSize" />

ここのpaddingTopが設定されているせいで上に空白ができてしまっています。
paddingTopを削除すると消えると思います。

投稿2019/11/23 09:38

退会済みユーザー

退会済みユーザー

総合スコア0

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

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

0

ベストアンサー

yukke_さんにベストアンサーしたいんですが回答場所がなかったため

android:paddingTop="?attr/actionBarSize"

を削除する

yukke_さん もしも書き込む時間があれば回答欄を変えてください。こちらからベストアンサーします

投稿2019/11/23 07:38

編集2019/11/23 07:39
退会済みユーザー

退会済みユーザー

総合スコア0

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問