Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.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 android隐藏内部相对论防止活动出现_Java_Android_Xml_Android Relativelayout - Fatal编程技术网

Java android隐藏内部相对论防止活动出现

Java android隐藏内部相对论防止活动出现,java,android,xml,android-relativelayout,Java,Android,Xml,Android Relativelayout,我有一个与内在相对论的相对论 我需要根据一些逻辑在里面隐藏一些相对的东西 问题是,如果我隐藏了我的任何内在亲戚,活动就会出现 我让它做我正在做的,但我的不行 这是我的密码 活动的XML <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.an

我有一个与内在相对论的相对论

我需要根据一些逻辑在里面隐藏一些相对的东西

问题是,如果我隐藏了我的任何内在亲戚,活动就会出现

我让它做我正在做的,但我的不行

这是我的密码

活动的XML

<?xml version="1.0" encoding="utf-8"?>
<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:background="@drawable/warning_bgnd"
    android:orientation="vertical" >

<Button
    android:id="@+id/button_warning"
    style="@style/okWarningButton"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="62dp" />

<RelativeLayout
    android:id="@+id/layout_warningA"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:layout_alignParentTop="true"
    android:layout_marginTop="70dp">

    <ImageView
        android:id="@+id/imageViewA"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button_warning"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="18dp"
        android:layout_marginTop="10dp"
        android:src="@drawable/warning_red"
        tools:ignore="ContentDescription" />

    <TextView
        android:id="@+id/warningTitleA"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="70dip"
        android:paddingTop="0px"
        android:text="@string/textarea_warning_title"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="#ffffff" />

    <TextView
        android:id="@+id/warningMessageA"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/warningTitleA"
        android:layout_marginTop="4dp"
        android:paddingLeft="70dip"
        android:text="@string/textarea_warning_cat_a"
        android:textColor="#B5B5B5"
        android:textSize="12sp" />
</RelativeLayout>


  <RelativeLayout
    android:id="@+id/layout_warningB"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:layout_alignParentTop="true"
    android:layout_marginTop="170dp">

    <ImageView
        android:id="@+id/imageViewB"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button_warning"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="18dp"
        android:layout_marginTop="10dp"
        android:src="@drawable/warning_orange"
        tools:ignore="ContentDescription" />

    <TextView
        android:id="@+id/warningTitleB"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="70dip"
        android:paddingTop="0px"
        android:text="@string/textarea_warning_title"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="#ffffff" />

    <TextView
        android:id="@+id/warningMessageB"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/warningTitleB"
        android:layout_marginTop="4dp"
        android:paddingLeft="70dip"
        android:text="@string/textarea_warning_cat_b"
        android:textColor="#B5B5B5"
        android:textSize="12sp" />
</RelativeLayout>

  <RelativeLayout
    android:id="@+id/layout_warningC"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:layout_alignParentTop="true"
    android:layout_marginTop="275dp">

    <ImageView
        android:id="@+id/imageViewC"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button_warning"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="18dp"
        android:layout_marginTop="10dp"
        android:src="@drawable/warning_green"
        tools:ignore="ContentDescription" />

    <TextView
        android:id="@+id/warningTitleC"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="70dip"
        android:paddingTop="0px"
        android:text="@string/textarea_warning_title"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="#ffffff" />

    <TextView
        android:id="@+id/warningMessageC"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/warningTitleC"
        android:layout_marginTop="4dp"
        android:paddingLeft="70dip"
        android:text="@string/textarea_warning_cat_c"
        android:textColor="#B5B5B5"
        android:textSize="12sp" />
    </RelativeLayout>

 </RelativeLayout>
所以,在我的测试中,如果我有案例1, 从未被调用,甚至看不到活动的内部日志

隐藏我的内部布局缺少什么


谢谢

您尚未定义按钮的布局宽度和布局高度。检查logcat,它应该给出某种错误。当您为按钮提供宽度和高度,并提供要在按钮上显示的文本或图像时,此代码起作用。你可以这样做

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/warningBtnText"

在底部的xml中,应该有两个相对布局的结束标记。这是在帖子中错误留下的还是您的代码的复制品?嗨@Anirudhaagahe,谢谢,现在为我编辑,上面的xml和代码工作得很好,正如您所期望的那样。。。如果我给1而不是开关盒内的warningTypeInt,则只有第一个相对布局可见。问题在于WarningTypePoint检查它正在检索什么值..您好,谢谢我已修复此问题,但不幸的是,这无法修复我的问题,可能是什么?您可以发布日志cat输出吗?另一件事是,在创建warningTypeInt时,可能会出现异常。在解析之前,请使用日志检查warningType的值。
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/warningBtnText"