jeudi 7 mai 2015

LinearLayout not work with RelativeLayout

I want to create following layout.

--------------------------------



 Title
 Summary                   Info

[Get Direction][Call][More Info]
--------------------------------

I code following layout but buttons not showing. I have no idea why LinearLayout works like FrameLayout so the RelativeLayout hides buttons. Did I miss something here? I am using support library 22.1

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://ift.tt/nIICcg"
    android:layout_width="match_parent"
    android:layout_height="@dimen/location_card_height">

    <ImageView android:id="@+id/cardImage"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="center"
        android:layout_gravity="center" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <RelativeLayout
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="bottom" >

            <TextView android:id="@+id/title"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLargeInverse"
                android:singleLine="true"
                android:hint="Title" />

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:layout_alignParentRight="true"
                android:layout_below="@id/title">

                <TextView android:id="@+id/info"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:textAppearance="?android:attr/textAppearance"
                    android:singleLine="true"
                    android:hint="Info"

                    android:layout_alignParentRight="true"
                    android:ellipsize="end" />

                <TextView android:id="@+id/summary"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:textAppearance="?android:attr/textAppearance"
                    android:singleLine="true"
                    android:hint="Summary"

                    android:layout_toLeftOf="@id/info"
                    android:ellipsize="end"  />
            </RelativeLayout>

        </RelativeLayout>

        <LinearLayout
            android:id="@+id/panelAction"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/btnDirection"
                android:text="@string/get_direction"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <Button
                android:id="@+id/btnCall"
                android:text="@string/label_call"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <Button
                android:id="@+id/btnMoreInfo"
                android:text="@string/more_info"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </LinearLayout>

    </LinearLayout>

</FrameLayout>

Aucun commentaire:

Enregistrer un commentaire