Wijden
Wijden

Reputation: 511

Android - ImageView and TextView not appearing

I want to display an ImageView then her TextView details followed by an other ImageView and her TextView details and then a text view and under them an ImageView then her TextView. So i put 2 child LinearLayouts that has orientation set to horizontal and the parent with orientation vertical but the second child LinearLayout is not appearing at all I don't know why. Thank you for helping. This is my activity.xml :

<?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="fill_parent"
    android:background="@drawable/fondgris"
    android:orientation="horizontal" >

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <LinearLayout
            android:id="@+id/linearLayout2"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/imageTypeWorkitem"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingRight="15dp"
                android:paddingTop="10dp"
                android:src="@drawable/bugicon" />

            <TextView
                android:id="@+id/typeWorkitem"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                android:textStyle="bold" />

            <ImageView
                android:id="@+id/imagePriority"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingRight="15dp"
                android:paddingTop="10dp"
                android:src="@drawable/priorityhigh" />

            <TextView
                android:id="@+id/priority"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/key"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/linearLayout3"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/imageStatus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingRight="15dp"
                android:paddingTop="10dp"
                android:src="@drawable/statusopen" />

            <TextView
                android:id="@+id/status"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/priority"
                android:textSize="14sp"
                android:textStyle="bold" />
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

Upvotes: 0

Views: 829

Answers (3)

Voicu
Voicu

Reputation: 17860

Your linearLayout1 has the property android:orientation="vertical" but then the very first child (linearLayout2) has android:layout_height="match_parent", which means the second child (linearLayout3) will have no space since first one will take over full height of the parent.

So you can change both children to have android:layout_height="wrap_content" and maybe add android:layout_weight="1" for both if you want.

Upvotes: 1

Eric Thiry
Eric Thiry

Reputation: 51

Not sure if I'm understanding this correctly but from what you describe I would try using a relative layout as your parent and creating linear layouts inside of that that are relative to each other (one on top of the other).

Upvotes: 0

Sankar V
Sankar V

Reputation: 4872

The content is larger than the screen and it is hidden. You must use ScrollView.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewPort="true" >

<LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/fondgris"
    android:orientation="horizontal" >
    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <LinearLayout
            android:id="@+id/linearLayout2"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/imageTypeWorkitem"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingRight="15dp"
                android:paddingTop="10dp"
                android:src="@drawable/bugicon" />

            <TextView
                android:id="@+id/typeWorkitem"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                android:textStyle="bold" />

            <ImageView
                android:id="@+id/imagePriority"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingRight="15dp"
                android:paddingTop="10dp"
                android:src="@drawable/priorityhigh" />

            <TextView
                android:id="@+id/priority"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/key"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/linearLayout3"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/imageStatus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingRight="15dp"
                android:paddingTop="10dp"
                android:src="@drawable/statusopen" />

            <TextView
                android:id="@+id/status"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/priority"
                android:textSize="14sp"
                android:textStyle="bold" />
        </LinearLayout>
    </LinearLayout>

</LinearLayout>
</ScrollView>

Upvotes: 0

Related Questions