Дизайн экрана меняется, если я выбираю данные из массива в RecyclerView
, но когда данные определены как статические (в XML), дизайн верен, что я должен сделать, чтобы сохранить дизайн таким, какой он есть в превью?
Я использую Fragments и recyclerView для раздувания данных из массива
![enter image description here](https://i.stack.imgur.com/2QDXC.png)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/rentInvoice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginBottom="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/paymentsDate"
android:textStyle="bold"
android:textColor="@color/colorFontHeading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/date"
android:textSize="18sp" />
<TextView
android:id="@+id/paymentsReceiptNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reciept_number" />
<TextView
android:id="@+id/paymentsData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PaymentData" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="end">
<TextView
android:id="@+id/paymentsAmount"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rs_000000"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/ic_navigate_next_black_24dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Выше приведен XML-код для Layout
Ниже приведен код XML, в котором находится RecyclerView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Fragments.PaymentsFragment"
android:orientation="vertical">
<SearchView
android:queryHint="@string/search"
android:layout_margin="15dp"
android:id="@+id/searchViewPayments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/search_view_rounded"
android:layoutDirection="rtl"/>
<LinearLayout
android:id="@+id/recyclerViewLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/paymentsRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
</LinearLayout>