Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Textview不显示内部框架布局_Java_Android_Android Layout_Android Framelayout - Fatal编程技术网

Java Textview不显示内部框架布局

Java Textview不显示内部框架布局,java,android,android-layout,android-framelayout,Java,Android,Android Layout,Android Framelayout,我有一个linearlayout和另一个linearlayout中的textview。将显示内部的linearlayout,但问题是最后一个textview未显示。为什么? 我有一个线性布局< /代码>,在一个 FrAMLayayOut/中,在一个 SypReFrESHealth> 中,并且在中间A代码> TeXVIEW,但是问题是 TeXVIEW在应用程序中模仿时没有显示。为什么呢 <LinearLayout xmlns:android="http://schemas.android.c

我有一个
linearlayout
和另一个
linearlayout
中的
textview
。将显示内部的
linearlayout
,但问题是最后一个
textview
未显示。为什么?

我有一个<代码>线性布局< /代码>,在一个<代码> FrAMLayayOut/<代码>中,在一个<代码> SypReFrESHealth> 中,并且在中间A代码> TeXVIEW,但是问题是 TeXVIEW在应用程序中模仿时没有显示。为什么呢

<LinearLayout 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:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".SearchResults">

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:id="@+id/content">


    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipeContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">



        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:layout_marginTop="50dp"
            android:text="EXAMPLE TEXT" />


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


</FrameLayout>


您的框架布局高度为0 设置为与父项匹配

线性布局(主) 瑞士鲜。。。 相对长度(重心)
然后,您的Textview使用以下代码更改xml文件

<LinearLayout 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:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".SearchResults">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/content">


        <android.support.v4.widget.SwipeRefreshLayout
            android:id="@+id/swipeContainer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:layout_marginTop="50dp"
                android:text="EXAMPLE TEXT" />
        </android.support.v4.widget.SwipeRefreshLayout>
    </FrameLayout>
</LinearLayout>

框架布局高度设置为0dp,请将其更改为与父级匹配。

尝试以下操作:

<RelativeLayout 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:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/content">


    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipeContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="EXAMPLE TEXT" />
    </android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>


它可以帮助您

@George Patsias在textview中更改文本颜色

我更改了它,但什么也没发生。Android studio表示要将其恢复到0dp以获得更好的性能。它还显示了以前基本活动中的搜索图标fab。。。我不想你可以删除框架布局并在SwipeRefresh之后插入线性布局…我将编辑答案…仍然没有更改。我是否也要发布我的BaseActivity代码?这是您的完整布局xml文件,或者在框架布局之后有更多元素?因为它丢失了,所以您可以提供完整的布局文件吗?您放置的布局在我的演示中显示文本视图