更新设计和支持库破坏了UI

时间:2017-03-06 14:27:47

标签: android android-layout android-fragments android-activity android-cardview

目前我们正在使用设计和支持库23.1.1,当我更新到25时,布局中存在很大差距,我无法弄清楚为什么

  • 很遗憾,我需要更多的声望来发布链接,文件中的所有链接,抱歉。

https://gist.github.com/xxqxpxx/a652a0c26a132913cd67faf21a670515

包含文件:build.gradle,layoutfile.xml,fragmentfile.xml,mainactivity,activity1。

之前的

截图:

enter image description here

截图:

enter image description here

1 个答案:

答案 0 :(得分:0)

在布局文件中,将根线性布局高度格式match_parent更改为wrap_content

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mainLinearLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="@dimen/authors_and_publishers_simpleDraweeView_margin_left"
    android:orientation="vertical">

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/authors_and_publishers_simpleDraweeView"
        android:layout_width="@dimen/author_publishers_simpledraweeview"
        android:layout_height="@dimen/author_publishers_simpledraweeview"
        android:layout_gravity="center_horizontal" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/authors_publishers_name_layout_margin_top"
        android:orientation="vertical">

        <com.kotobi.widget.fonts.views.textviews.RobotoLight
            android:id="@+id/authorName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:lines="1"
            android:text="Name"
            android:textSize="@dimen/author_publisher_pop_up_followrs_text_size" />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/authors_and_publishers_simpleDraweeView_margin_top">


            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

                <ImageView
                    android:layout_width="@dimen/author_publisher_pop_up_image_dimen"
                    android:layout_height="@dimen/author_publisher_pop_up_image_dimen"
                    android:layout_gravity="center_vertical"
                    android:layout_marginRight="@dimen/author_publisher_pop_up_image_dimen_margin_right"
                    android:background="@drawable/followers" />

                <com.kotobi.widget.fonts.views.textviews.RobotoLight
                    android:id="@+id/numberOfFollowers"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:text="12"
                    android:textColor="@color/grey"
                    android:textSize="@dimen/author_publisher_pop_up_followrs_number_books" />


            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true">

                <ImageView
                    android:layout_width="@dimen/author_publisher_pop_up_image_dimen"
                    android:layout_height="@dimen/author_publisher_pop_up_image_dimen"
                    android:layout_gravity="center_vertical"
                    android:layout_marginRight="@dimen/author_publisher_pop_up_image_dimen_margin_right"
                    android:background="@drawable/number_books" />

                <com.kotobi.widget.fonts.views.textviews.RobotoLight
                    android:id="@+id/numberOfBooks"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:text="12"
                    android:textColor="@color/grey"
                    android:textSize="@dimen/author_publisher_pop_up_followrs_number_books" />
            </LinearLayout>
        </RelativeLayout>

    </LinearLayout>

</LinearLayout>