TextView未在RelativeLayout

时间:2017-09-04 01:07:11

标签: android android-layout textview

我的项目中有一些弹出窗口可以完美运行,但是这个看起来不起作用,他只显示按钮,文本视图不会出现(抱歉为不好的工程)我试图使用其他布局,但是看起来并不好......我想做的就是简单地在屏幕中间使用3个文本视图,如果你们可以帮助我,我会很高兴

popadd.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:background="@drawable/dialog_round">

<ImageButton
    android:id="@+id/btCancelar"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:src="@drawable/cancel"
    android:tint="#ffffff"
    android:background="@drawable/round_button"
    android:padding="5dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_marginBottom="5dp"
    android:layout_marginRight="90dp" />

<ImageButton
    android:id="@+id/btEnviar"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:src="@drawable/certo"
    android:tint="#ffffff"
    android:background="@drawable/round_button"
    android:padding="5dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_marginBottom="5dp"
    android:layout_marginRight="30dp" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Adicionar amigo"
    android:textSize="70px"
    android:textColor="#454545"
    android:layout_marginTop="190dp"
    android:layout_centerHorizontal="true"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Enviar solicitação de amizade para"
    android:textSize="40px"
    android:textColor="#454545"
    android:layout_marginTop="240dp"
    android:layout_centerHorizontal="true"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/tvNome"
    android:text="Carregando..."
    android:textSize="40px"
    android:textColor="#454545"
    android:layout_marginTop="270dp"
    android:layout_centerHorizontal="true"/>

</RelativeLayout>

1 个答案:

答案 0 :(得分:0)

在您的代码中尝试此操作。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:background="@drawable/dialog_round">

<ImageButton
    android:id="@+id/btCancelar"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_marginBottom="5dp"
    android:layout_marginRight="90dp"
    android:background="@drawable/round_button"
    android:padding="5dp"
    android:src="@drawable/cancel"
    android:tint="#ffffff"/>

<ImageButton
    android:id="@+id/btEnviar"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_marginBottom="5dp"
    android:layout_marginRight="30dp"
    android:background="@drawable/round_button"
    android:padding="5dp"
    android:src="@drawable/certo"
    android:tint="#ffffff"/>

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:gravity="center"
    android:orientation="vertical">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:text="Adicionar amigo"
        android:textColor="#454545"
        android:textSize="70px"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="10dp"
        android:text="Enviar solicitação de amizade para"
        android:textColor="#454545"
        android:textSize="40px"/>

    <TextView
        android:id="@+id/tvNome"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="10dp"
        android:text="Carregando..."
        android:textColor="#454545"
        android:textSize="40px"/>
</LinearLayout>
</RelativeLayout>