简体   繁体   中英

Content inside linear layout is not showing

Im trying to generate a table layout inside a linear layout and anything I put inside the second layout does not shows up. I'm trying to do something like this:

https://www.dropbox.com/s/gnk3plt0ci3d2u8/tabla.png?dl=0

http://pastebin.com/USMrxJSn

The width and height property that you have set to the inner Linear Layout causes the problem for you. Actually the values are shown but are not visible to you.

I would recommend you to use weightsem property to control the width of the layout.

Try the code below and I hope that should work for you.

Code..

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        tools:context=".LinearLayout" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal"
            android:weightSum="100" >

            <ImageView
                android:id="@+id/profile_picture"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="20"
                android:padding="15dp"
                android:src="@drawable/ic_launcher" />

            <TableLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="80"
                android:padding="20dp" >

                <TableRow>

                    <TextView android:text="Emma Watson" />
                </TableRow>

                <TableRow>

                    <TextView android:text="Calorias" />
                </TableRow>

                <TableRow>

                    <TextView android:text="CO2" />
                </TableRow>

                <TableRow>

                    <TextView android:text="Distancia" />
                </TableRow>
            </TableLayout>
        </LinearLayout>


    </LinearLayout>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM