У меня есть макет Android, который используется для отображения диалогового окна предупреждения о «приложении» с кнопкой «Закрыть». Он имеет заголовок в bold с центром, версия приложения и имя разработчика. Все выглядит отлично, за исключением того, что над заголовком есть заметный запас/надпись, и я не могу удалить это пустое пространство.Удалить диалоговое окно Android alert пустое место наверху
Вот раскладка:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:orientation="vertical" android:scrollbars="none" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginRight="6.0dp" xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_gravity="center">
<TextView android:textSize="16.0dip" android:textStyle="bold" android:textColor="#ffffffff" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="6.0dip" android:layout_marginRight="6.0dip" android:layout_marginBottom="10.0dip" android:text="@string/app_name" />
</LinearLayout>
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal">
<TextView android:textSize="14.0dip" android:textColor="#ffffffff" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="6.0dip" android:layout_marginTop="0.0dip" android:text="@string/version_text" />
<TextView android:textSize="14.0dip" android:textColor="#ffffffff" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="6.0dip" android:layout_marginTop="0.0dip" android:text="@string/app_version" />
</LinearLayout>
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical">
<TextView android:textSize="14.0dip" android:textColor="#ffffffff" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="6.0dip" android:text="@string/about_developer" />
</LinearLayout>
<LinearLayout android:gravity="center" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10.0dip" xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:id="@id/close_btn" android:layout_width="110.0dip" android:layout_height="44.0dip" android:layout_marginTop="4.0dip" android:layout_marginBottom="4.0dip" android:text="@string/about_close" />
</LinearLayout>
</LinearLayout>
</ScrollView>
И вот что он показывает:
Я попытался добавить android:layout_marginTop="-10.0dip"
атрибут во многих тегов и поиск SO для подобного вопроса, но я могу» t найти его. Я был бы благодарен, если кто-нибудь покажет мне, как решить эту проблему.
Я был на полпути с тем же ответом. Отлично сработано. –
Я пытаюсь применить ваш ответ, и Android Studio сообщает мне, что «MainActivity не является закрывающим классом» каких-либо идей? Пожалуйста помоги. –
отредактирован! положите контекст! – DevAndroid