布局资源显示不正确

时间:2018-07-14 04:32:17

标签: android android-layout

我试图正确显示布局,但有时显示不正确,我不知道发生了什么,我会尝试但是没有发现任何问题。

这就是我想要的

output that I want

这是我有时会得到的

output that i am getting some times

当我滚动时,它又可以正常工作了 请帮我为什么有时会得到这个输出

这是我的layout资源文件:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".activity.MainActivity"
    android:background="@color/white">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:id="@+id/appbar"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:id="@+id/ctolbar"
            android:fitsSystemWindows="true"
            app:contentScrim="@color/colorPrimary"
            app:expandedTitleMargin="5dp"
            app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
            android:layout_height="match_parent">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="@dimen/_200sdp"
                android:orientation="vertical">

                <RelativeLayout
                    android:id="@+id/layout_top"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <FrameLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent">

                        <android.support.v4.view.ViewPager
                            android:id="@+id/viewPager"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent" />

                    </FrameLayout>

                    <me.relex.circleindicator.CircleIndicator
                        android:id="@+id/indicator"
                        android:layout_width="match_parent"
                        android:layout_height="@dimen/_48sdp"
                        android:layout_gravity="bottom"
                        app:ci_animator="@animator/indicator_animator"
                        app:ci_animator_reverse="@animator/indicator_animator_reverse"
                        app:ci_drawable="@drawable/black_radius_square"
                        app:ci_height="@dimen/_4sdp"
                        app:ci_margin="@dimen/_6sdp"
                        android:layout_marginBottom="@dimen/_5sdp"
                        app:ci_width="@dimen/_10sdp"
                        android:layout_alignParentBottom="true"/>

                </RelativeLayout>

            </RelativeLayout>

            <!--<View
                android:layout_width="match_parent"
                android:layout_height="160dp"
                android:layout_gravity="bottom"
                android:background="@drawable/scrim"/>-->

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:textSize="@dimen/_2sdp"
                android:textColor="#4D212121"
                android:text="MM" />
        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>


    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:id="@+id/nested"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:layout_marginBottom="@dimen/_45sdp"
        app:behavior_overlapTop="@dimen/_34sdp"
        android:layout_height="match_parent">

        <LinearLayout
            android:id="@+id/lnmain"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="gone"
            android:layout_marginTop="@dimen/_15sdp"
            android:orientation="vertical">

            <RelativeLayout
                android:id="@+id/rlsearch"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:descendantFocusability="beforeDescendants"
                android:focusableInTouchMode="true">

                <EditText
                    android:id="@+id/editsearch"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/_40sdp"
                    android:background="@drawable/search_edittext"
                    android:hint="Search Events"
                    android:shadowColor = "#39ffff"
                    android:focusableInTouchMode="true"
                    android:maxLength="100"
                    android:paddingLeft="@dimen/_10sdp"
                    android:paddingRight="@dimen/_10sdp"
                    android:layout_marginRight="@dimen/_5sdp"
                    android:layout_marginLeft="@dimen/_5sdp"
                    android:textColor="@color/black"
                    android:singleLine="true"
                    android:imeOptions="actionDone"
                    android:drawableRight="@drawable/ic_search_black_24dp"
                    android:layout_marginBottom="@dimen/_5sdp"/>

            </RelativeLayout>

            <LinearLayout
                android:id="@+id/lnweekend"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="@dimen/_10sdp"
                android:layout_marginLeft="@dimen/_10sdp"
                android:layout_marginTop="@dimen/_5sdp"
                android:layout_marginBottom="@dimen/_5sdp"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/_10sdp"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/tvweekend"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="start|center_vertical"
                        android:layout_weight="1"
                        android:textSize="@dimen/_15sdp"
                        android:textColor="@color/black"
                        android:text="Popular This Weekend"/>

                    <TextView
                        android:id="@+id/tvweekendviewmore"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="right"
                        android:layout_weight="1"
                        android:layout_gravity="right|center_vertical"
                        android:textColor="@color/text"
                        android:textSize="@dimen/_10sdp"
                        android:text="@string/more"/>
                </LinearLayout>

                <com.takusemba.multisnaprecyclerview.MultiSnapRecyclerView
                    android:id="@+id/rvweekend"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    app:msrv_gravity="start"
                    app:msrv_ms_per_inch="@dimen/normal_speed"
                    app:msrv_snap_count="1" />


            </LinearLayout>

            <LinearLayout
                android:id="@+id/lnevents"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="@dimen/_10sdp"
                android:layout_marginLeft="@dimen/_10sdp"
                android:layout_marginTop="@dimen/_5sdp"
                android:layout_marginBottom="@dimen/_5sdp"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/_10sdp"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/tvevents"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="start|center_vertical"
                        android:layout_weight="1"
                        android:textSize="@dimen/_15sdp"
                        android:textColor="@color/black"
                        android:text="Popular Events"/>

                    <TextView
                        android:id="@+id/tveventsviewmore"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="right"
                        android:layout_weight="1"
                        android:layout_gravity="right|center_vertical"
                        android:textColor="@color/text"
                        android:textSize="@dimen/_10sdp"
                        android:text="@string/more"/>
                </LinearLayout>

                <com.takusemba.multisnaprecyclerview.MultiSnapRecyclerView
                    android:id="@+id/rvevents"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    app:msrv_gravity="start"
                    app:msrv_ms_per_inch="@dimen/normal_speed"
                    app:msrv_snap_count="1" />


            </LinearLayout>

            <LinearLayout
                android:id="@+id/lnconcert"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="@dimen/_10sdp"
                android:layout_marginLeft="@dimen/_10sdp"
                android:layout_marginTop="@dimen/_5sdp"
                android:layout_marginBottom="@dimen/_5sdp"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/_10sdp"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/tvconsert"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="start|center_vertical"
                        android:layout_weight="1"
                        android:textSize="@dimen/_15sdp"
                        android:textColor="@color/black"
                        android:text="Trending Concerts"/>

                    <TextView
                        android:id="@+id/tvconsertviewmore"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="right"
                        android:layout_weight="1"
                        android:layout_gravity="right|center_vertical"
                        android:textColor="@color/text"
                        android:textSize="@dimen/_10sdp"
                        android:text="@string/more"/>
                </LinearLayout>

                <com.takusemba.multisnaprecyclerview.MultiSnapRecyclerView
                    android:id="@+id/rvconcert"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    app:msrv_gravity="start"
                    app:msrv_ms_per_inch="@dimen/normal_speed"
                    app:msrv_snap_count="1" />


            </LinearLayout>

            <LinearLayout
                android:id="@+id/lnsport"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="@dimen/_10sdp"
                android:layout_marginLeft="@dimen/_10sdp"
                android:layout_marginTop="@dimen/_5sdp"
                android:layout_marginBottom="@dimen/_5sdp"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/_10sdp"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/tvsport"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="start|center_vertical"
                        android:layout_weight="1"
                        android:textSize="@dimen/_15sdp"
                        android:textColor="@color/black"
                        android:text="Trending Sports"/>

                    <TextView
                        android:id="@+id/tvsportviewmore"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="right"
                        android:layout_weight="1"
                        android:layout_gravity="right|center_vertical"
                        android:textColor="@color/text"
                        android:textSize="@dimen/_10sdp"
                        android:text="@string/more"/>
                </LinearLayout>

                <com.takusemba.multisnaprecyclerview.MultiSnapRecyclerView
                    android:id="@+id/rvsports"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    app:msrv_gravity="start"
                    app:msrv_ms_per_inch="@dimen/normal_speed"
                    app:msrv_snap_count="1" />
                <!--<android.support.v7.widget.RecyclerView
                    android:id="@+id/rvsports"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:clipToPadding="false"
                    android:scrollbars="horizontal" />-->

            </LinearLayout>

            <LinearLayout
                android:id="@+id/lntheater"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="@dimen/_10sdp"
                android:layout_marginLeft="@dimen/_10sdp"
                android:layout_marginTop="@dimen/_5sdp"
                android:layout_marginBottom="@dimen/_5sdp"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/_10sdp"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/tvtheater"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="start|center_vertical"
                        android:layout_weight="1"
                        android:textSize="@dimen/_15sdp"
                        android:textColor="@color/black"
                        android:text="Trending Theater"/>

                    <TextView
                        android:id="@+id/tvtheaterviewmore"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="right"
                        android:layout_weight="1"
                        android:layout_gravity="right|center_vertical"
                        android:textColor="@color/text"
                        android:textSize="@dimen/_10sdp"
                        android:text="@string/more"/>
                </LinearLayout>

                <com.takusemba.multisnaprecyclerview.MultiSnapRecyclerView
                    android:id="@+id/rvtheater"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    app:msrv_gravity="start"
                    app:msrv_ms_per_inch="@dimen/normal_speed"
                    app:msrv_snap_count="1" />

                <!--<android.support.v7.widget.RecyclerView
                    android:id="@+id/rvtheater"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:clipToPadding="false"
                    android:scrollbars="horizontal" />-->

            </LinearLayout>

            <LinearLayout
                android:id="@+id/lnother"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="@dimen/_10sdp"
                android:layout_marginLeft="@dimen/_10sdp"
                android:layout_marginTop="@dimen/_5sdp"
                android:layout_marginBottom="@dimen/_5sdp"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/_10sdp"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/tvother"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="start|center_vertical"
                        android:layout_weight="1"
                        android:textSize="@dimen/_15sdp"
                        android:textColor="@color/black"
                        android:text="Trending Other"/>

                    <TextView
                        android:id="@+id/tvotherviewmore"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="right"
                        android:layout_weight="1"
                        android:layout_gravity="right|center_vertical"
                        android:textColor="@color/text"
                        android:textSize="@dimen/_10sdp"
                        android:text="@string/more"/>
                </LinearLayout>

                <com.takusemba.multisnaprecyclerview.MultiSnapRecyclerView
                    android:id="@+id/rvother"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    app:msrv_gravity="start"
                    app:msrv_ms_per_inch="@dimen/normal_speed"
                    app:msrv_snap_count="1" />
                <!--<android.support.v7.widget.RecyclerView
                    android:id="@+id/rvother"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:clipToPadding="false"
                    android:scrollbars="horizontal" />-->

            </LinearLayout>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:textSize="@dimen/_2sdp"
                android:textColor="#4D212121"
                android:text="MM" />

        </LinearLayout>

    </android.support.v4.widget.NestedScrollView>

    <ProgressBar
        android:visibility="gone"
        android:id="@+id/progressBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:indeterminate="true"
        android:layout_gravity="center"
        android:indeterminateTint="@color/colorPrimary"
        android:layout_centerVertical="true" />


    <io.saeid.fabloading.LoadingView
        android:id="@+id/loading_view_repeat"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:mfl_onclickLoading="true"
        android:layout_gravity="center"
        android:visibility="visible"
        android:scaleX="1"
        android:scaleY="1"
        app:mfl_duration="400"
        app:mfl_repeat="100" />

    <LinearLayout
        android:id="@+id/lnloading"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center_horizontal"
        android:layout_marginTop="@dimen/_80sdp"
        android:visibility="visible"
        android:orientation="horizontal">


        <TextView
            android:id="@+id/tvloading"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/loading"
            android:textColor="@color/black"
            android:layout_marginRight="@dimen/_5sdp"
            android:textStyle="bold"
            android:textSize="@dimen/_10sdp"/>

        <com.bhargavms.dotloader.DotLoader
            android:layout_width="wrap_content"
            android:layout_height="@dimen/_10sdp"
            app:dot_radius="@dimen/_2sdp"
            app:color_array="@array/dot_colors"
            android:layout_gravity="bottom"
            app:number_of_dots="3"/>
    </LinearLayout>

    <RelativeLayout
        android:id="@+id/rlerror"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:layout_gravity="center">

        <ImageView
            android:id="@+id/imgerror"
            android:layout_width="@dimen/_125sdp"
            android:layout_height="@dimen/_125sdp"
            android:visibility="visible"
            android:layout_centerHorizontal="true"
            android:background="@drawable/no_conncectionp" />

        <TextView
            android:id="@+id/tverror"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="visible"
            android:textColor="@color/black"
            android:textStyle="bold"
            android:layout_centerHorizontal="true"
            android:textSize="@dimen/_18sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:layout_below="@id/imgerror"
            android:text="Whoops" />

        <TextView
            android:id="@+id/tvstatus"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="visible"
            android:textColor="@color/text"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="@dimen/_10sdp"
            android:layout_gravity="center_horizontal"
            android:textSize="@dimen/album_title"
            android:layout_below="@id/tverror"
            android:text="No Data" />
    </RelativeLayout>


    <RelativeLayout
        android:id="@+id/bottomnavigation"
        android:layout_width="match_parent"
        android:layout_height="@dimen/_45sdp"
        android:layout_gravity="bottom"
        android:layout_alignParentBottom="true">

        <com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
            android:id="@+id/bottomNavViewBar"
            android:layout_width="match_parent"
            android:layout_height="@dimen/_43sdp"
            android:layout_alignParentBottom="true"
            android:background="@android:color/white"
            app:itemIconTint="@color/selector_item_primary_color"
            app:itemTextColor="@color/selector_item_primary_color"
            app:menu="@menu/bottom_navigation_menu_3" />

    </RelativeLayout>

</android.support.design.widget.CoordinatorLayout>

有时我只会得到此输出,请帮助我。

任何建议将不胜感激。

0 个答案:

没有答案