视图不相对布局中显示视图、布局

2023-09-06 13:09:10 作者:疏狂几曾

我有这样的布局有问题,我无法找出什么是错的。 正如你所看到的,有一个天文台表和相对布局中的表格,但计时表没有显示,甚至没有一个空格。

I have a problem with this layout and i cannot find out what is wrong. As you can see, there is a chronometer and a table inside a relative layout but the chronometer does not show, not even a blank space.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/firstLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Chronometer
    android:id="@+id/chrono"
    android:textColor="#4169E1"
    android:textSize="20sp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/parentLayout"
    android:layout_centerHorizontal="true"
    android:text="Chronometer"
/>
<TableLayout 
    android:id="@+id/parentLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
</TableLayout>
</RelativeLayout>

什么想法?

推荐答案

我终于得到了显示天文台表的方式。 谢谢大家谁试图帮助我,答案是非常接近我的解决方案是:

finally i got the way to display the chronometer. Thanks to everyone who tried to help me, the answers were really close to my solution which is:

<Chronometer
android:id="@+id/chrono"
android:textColor="#4169E1"
android:textSize="20sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Chronometer"
/>
<TableLayout 
android:id="@+id/parentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/chrono"
>