文字视图未显示

时间:2016-06-19 09:05:52

标签: android android-linearlayout textview android-collapsingtoolbarlayout

我创建了一个可折叠的工具栏,其中包含与学生相关的数据。 我的问题是最后的线性布局没有显示出来。

enter <?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<android.support.design.widget.AppBarLayout
    android:id="@+id/app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:fitsSystemWindows="true">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleMarginStart="48dp"
        app:expandedTitleMarginEnd="64dp"
        android:fitsSystemWindows="true">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <SearchView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/search_user"

                />

            <ImageView
                android:layout_width="110dp"
                android:layout_height="110dp"
                android:src="@drawable/person"
                android:layout_centerHorizontal="true"
                android:id="@+id/display_picture"
                android:layout_below="@+id/search_user"/>



            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:layout_below="@+id/display_picture"
                android:id="@+id/linear_name">
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:textColor="#FFF"
                    android:textSize="20dp"
                    android:textStyle="bold"
                    android:gravity="right"
                    android:text="First Name here "
                    android:id="@+id/tvDisplayFName" />
                <TextView
                    android:layout_width="fill_parent"
                    android:textColor="#FFF"
                    android:layout_height="wrap_content"
                    android:textSize="20dp"
                    android:textStyle="bold"
                    android:layout_weight="1"
                    android:gravity="left"
                    android:text=" Last Name here"
                    android:id="@+id/tvDisplayLName" />
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:textColor="#FFF"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:layout_below="@+id/linear_name"
                android:id="@+id/linear_branch_year">
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:textColor="#FFF"
                    android:text="Branch here "
                    android:gravity="right"
                    android:layout_below="@+id/linear_name"
                    android:id="@+id/tvDisplayBranch" />
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text=" Year here"
                    android:textColor="#FFF"
                    android:id="@+id/tvDisplayYear" />
            </LinearLayout>
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textColor="#FFF"
                android:layout_weight="1"
                android:layout_below="@+id/linear_branch_year"
                android:gravity="center"
                android:text="Section here"
                android:id="@+id/tvDisplaySection" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="#FFF"
                android:gravity="center"
                android:layout_below="@+id/tvDisplaySection"
                android:id="@+id/linear_post_rate">
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:textColor="#FFF"
                    android:text="Posts"
                    android:gravity="center"
                    android:id="@+id/tvDisplayPosts" />
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:textColor="#FFF"
                    android:gravity="center"
                    android:text="Rate"
                    android:id="@+id/tvDisplayRating" />
            </LinearLayout>
            <LinearLayout    //NOT SHOWING
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="#FFF"
                android:gravity="center"
                android:layout_below="@+id/linear_post_rate"
                android:id="@+id/linear_value">
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:textColor="#FFF"
                    android:text="Posts"
                    android:gravity="center"
                    android:id="@+id/tvPostsValue" />
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:textColor="#FFF"
                    android:gravity="center"
                    android:text="Rate"
                    android:id="@+id/tvRatingValue" />
            </LinearLayout>

        </RelativeLayout>


        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:layout_collapseMode="pin" />

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

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

<android.support.v4.widget.NestedScrollView
    android:id="@+id/scroll"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">


    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        app:cardElevation="6dp"
        app:cardUseCompatPadding="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:id="@+id/description"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="30dp"
                android:text="@string/large_text"
                android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>

        </LinearLayout>

    </android.support.v7.widget.CardView>


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

未显示id = linear_value的线性布局。可能是什么问题?

1 个答案:

答案 0 :(得分:1)

AppBarLayout

<android.support.design.widget.AppBarLayout
    android:id="@+id/app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:fitsSystemWindows="true">
如果未显示布局数据,请

指定一些特定高度。改变它。

<android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="350dp"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:fitsSystemWindows="true">
相关问题