简体   繁体   English

线性布局内的内容未显示

[英]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 https://www.dropbox.com/s/gnk3plt0ci3d2u8/tabla.png?dl=0

http://pastebin.com/USMrxJSn http://pastebin.com/USMrxJSn

The width and height property that you have set to the inner Linear Layout causes the problem for you. 设置为内部线性布局的width和height属性会给您带来问题。 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. 我建议您使用weightsem属性来控制布局的宽度。

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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