0

データの一覧を表示するためのカード レイアウトを作成しました。何らかの理由で、レイアウトの幅、高さ、重量などのプロパティを変更しても、以下に示すように、テキストは常に他のテキスト行の上に表示されます。

ここに画像の説明を入力

私は何が欠けていますか?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:background="@drawable/card_inset">

<RelativeLayout
    android:id="@+id/eventDetails"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="70"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/eventTeams"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:textSize="17sp" />

    <TextView
        android:id="@+id/eventClickForMore"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:textSize="14sp" />

</RelativeLayout>

<RelativeLayout
    android:id="@+id/eventTimeSection"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="30"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/eventTime"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center"
        android:textSize="22sp" />

    <TextView
        android:id="@+id/eventDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:gravity="center"
        android:textAlignment="center"
        android:textSize="12sp" />

</RelativeLayout>

4

2 に答える 2

0

で使用できandroid:layout_belowます。TextViewid @+id/eventClickForMore

見る

<TextView
    android:id="@+id/eventClickForMore"
    android:layout_width="fill_parent"
    android:layout_below = "@id/eventTeams"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:textSize="14sp" />
于 2013-09-15T19:25:14.820 に答える
0

TextView呼び出されeventClickForMoreたに、属性を追加しますandroid:layout_below="@+id/eventTeams"

そして、以下にあるはずのTextView呼び出されたものに対して同じことを行いますeventDateeventTime

編集

コードを更新しました。基本的に、とのlayout_height属性をに変更する必要があります。すべてのスペースを垂直に取るようにしました。eventTeamseventTimeSectionandroid:layout_height="wrap_content"match_parentTextView

android:layout_alignParentBottomまた、 andandroid:layout_alignParentLeftを取り除くこともできると思います(確かではeventClickForMoreありeventDateませんが、おそらく最初の更新で十分でしょう)。

以下の私のコードを参照してください:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:background="@drawable/card_inset">

<RelativeLayout
    android:id="@+id/eventDetails"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="70"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/eventTeams"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="17sp" />

    <TextView
        android:id="@+id/eventClickForMore"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/eventTeams"
        android:textSize="14sp" />

</RelativeLayout>

<RelativeLayout
    android:id="@+id/eventTimeSection"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="30"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/eventTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textSize="22sp" />

    <TextView
        android:id="@+id/eventDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/eventTime"
        android:gravity="center"
        android:textAlignment="center"
        android:textSize="12sp" />

</RelativeLayout>

于 2013-09-15T19:25:21.130 に答える