Khi sử dụng các đoạn, bố trí của tôi bị xáo trộn bởi một khoảng trống ở trên cùng và tôi không biết vị trí này đến từ đâu. Nó trông giống như thế này:Bố cục lề/phần đệm ở đầu đoạn hộp thoại
nguồn có thể cho không gian trống rỗng này là gì? Chủ đề hoặc một số cài đặt kiểu tôi chưa tìm thấy hoặc không gian này được dành riêng cho thanh tác vụ? Tôi thực sự muốn loại bỏ điều này.
Dưới đây là xml bố trí tương ứng và mã để nhanh chóng thoại:
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>
Java:
FragmentManager fm = this.getSupportFragmentManager();
mSearchingDialog = new SearchingDialogFragment();
Bundle bundle = new Bundle();
bundle.putString("name", mCityToAdd.userName());
mSearchingDialog.setArguments(bundle);
mSearchingDialog.show(fm, TAG);
Tôi cũng hỏi câu hỏi này ở đây, suy nghĩ nó sẽ là một vấn đề tương quan với một scrollview, nhưng không gian xuất hiện trong tất cả các mảnh của tôi:
ScrollView adds extra space on top
Bản sao có thể có của [Cách tạo DialogFragment không có tiêu đề?] (Http://stackoverflow.com/questions/15277460/how-to-create-a-dialogfragment-without-title) –