Как настроить высоту ImageView в RelativeLayout в Android

Техника ниже помогла мне много раз:

System.out.println(TheNoDefFoundClass.class.getProtectionDomain().getCodeSource().getLocation());

, где TheNoDefFoundClass - это класс, который может быть «потерян» из-за предпочтения старой версии той же библиотеки, что и ваша программа. Это чаще всего случается с случаями, когда клиентское программное обеспечение развертывается в доминирующем контейнере, вооружившись его собственными загрузчиками классов и множеством древних версий самых популярных библиотек.

0
задан Onik 4 April 2019 в 22:14
поделиться

2 ответа

Попытка повторить дизайн в соответствии с вашими требованиями.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
>

<ImageView
    android:id="@+id/ErrorImageView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="fitCenter"
    android:adjustViewBounds="true"
    android:layout_above="@id/ErrorTextView"
    android:background="@mipmap/ic_launcher"
    android:layout_marginTop="10dp"
    android:layout_centerHorizontal="true"/>

<TextView
    android:id="@+id/ErrorTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/app_name"
    android:lines="3"
    android:layout_centerHorizontal="true"
   android:layout_above="@id/RetryButton"
    android:layout_marginHorizontal="10dp"
    android:layout_marginTop="10dp"

    android:gravity="center_horizontal"/>

<Button
    android:id="@+id/RetryButton"
    android:layout_width="100dp"
    android:layout_height="50dp"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="10dp"
    />

   </RelativeLayout>

Надеюсь, это поможет.

0
ответ дан Kaveri 4 April 2019 в 22:14
поделиться

попробуйте

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:background="@color/color_white"
    android:gravity="center_horizontal"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/ErrorImageView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginTop="@dimen/cards_error_image_margin_top"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:scaleType="fitCenter" />

    <TextView
        android:id="@+id/ErrorTextView"
        style="@style/CustomFont30Marine"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/cards_error_text_margin_top"
        android:gravity="center_horizontal" />

    <Button
        android:id="@+id/RetryButton"
        style="@style/WhiteCustomButton"
        android:layout_width="@dimen/cards_error_retry_button_width"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/cards_error_retry_button_margin_bottom" />

</LinearLayout>
0
ответ дан Muhammad Muzammil Sharif 4 April 2019 в 22:14
поделиться
Другие вопросы по тегам:

Похожие вопросы: