TextView中是不可见的 [英] TextView is not visible

查看:172
本文介绍了TextView中是不可见的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请看看下面code

<RelativeLayout 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"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".Game" >

    <TextView
        android:id="@+id/numberOfQuestionsLeft"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="20dp"
        android:text="TextView" />

    <TextView
        android:id="@+id/numberOfCorrectAnswers"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/numberOfQuestionsLeft"
        android:layout_alignBottom="@+id/numberOfQuestionsLeft"
        android:layout_marginLeft="34dp"
        android:layout_toRightOf="@+id/numberOfQuestionsLeft"
        android:text="TextView" />

    <LinearLayout 
        android:id="@+id/linearOne"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="#49494f"
        android:layout_below="@+id/numberOfCorrectAnswers"
        android:paddingTop="20dp"
        >

        <TextView
            android:id="@+id/hint"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginBottom="30dp"
            android:text="Medium Text"
            android:textColor="#ffffff" />

    </LinearLayout>

</RelativeLayout>

这给出了以下

正如你所看到的,提示应出现内部线性布局是不可见的TextView。为什么是这样?请

As you can see, the hint textview which should appear inside the Linear Layout is not visible. Why is this? Please

推荐答案

删除的android:layout_marginBottom =30dp从你的提示文本视图:

Remove android:layout_marginBottom="30dp" from your hint text view :

    <LinearLayout
    android:id="@+id/linearOne"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:background="#49494f"
    android:layout_below="@+id/numberOfCorrectAnswers"
    android:paddingTop="20dp" >

    <TextView
        android:id="@+id/hint"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:text="Medium Text"
        android:textColor="#ffffff" />

</LinearLayout >

其实你不需要线性布局,只是这样做:

Actually you dont need that Linear Layout, just do like this :

<RelativeLayout 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"
            android:paddingBottom="@dimen/activity_vertical_margin"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingTop="@dimen/activity_vertical_margin"
            tools:context=".Game" >

<TextView
    android:id="@+id/numberOfQuestionsLeft"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="20dp"
    android:text="TextView" />

<TextView
    android:id="@+id/numberOfCorrectAnswers"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/numberOfQuestionsLeft"
    android:layout_alignBottom="@+id/numberOfQuestionsLeft"
    android:layout_marginLeft="34dp"
    android:layout_toRightOf="@+id/numberOfQuestionsLeft"
    android:text="TextView" />


<TextView
    android:id="@+id/hint"
    android:background="#49494f"
    android:paddingTop="20dp"
    android:layout_below="@+id/numberOfCorrectAnswers"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_marginBottom="30dp"
    android:text="Medium Text"
    android:textColor="#ffffff" />

</RelativeLayout >

这篇关于TextView中是不可见的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆