フラグメントを使用すると、レイアウトが上部の追加スペースによって妨げられ、これがどこから来ているのかわかりません。次のようになります。
この空きスペースの原因として考えられるものは何ですか? まだ見つけていないテーマやスタイル設定、またはこのスペースはアクションバー用に予約されていますか? 私は本当にこれを取り除きたいです。
対応するレイアウト xml と、ダイアログをインスタンス化するコードを次に示します。
XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_margin="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:layout_margin="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/search_progress"
style="?android:attr/progressBarStyle"
android:indeterminate="true" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/search_progress"
android:text="Searching for:" />
<TextView
android:id="@+id/searchingNameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:layout_alignBottom="@+id/search_progress"
android:layout_alignLeft="@+id/textView1"
android:text="Barcelona" />
</RelativeLayout>
ジャワ:
FragmentManager fm = this.getSupportFragmentManager();
mSearchingDialog = new SearchingDialogFragment();
Bundle bundle = new Bundle();
bundle.putString("name", mCityToAdd.userName());
mSearchingDialog.setArguments(bundle);
mSearchingDialog.show(fm, TAG);
スクロールビューに関連する問題だと思って、ここでもこの質問をしましたが、すべてのフラグメントにスペースが表示されます。