簡體   English   中英

線性布局內的內容未顯示

[英]Content inside linear layout is not showing

我試圖在線性布局內生成表格布局,而我在第二個布局內放置的任何內容均未顯示。 我正在嘗試做這樣的事情:

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

http://pastebin.com/USMrxJSn

設置為內部線性布局的width和height屬性會給您帶來問題。 實際上,這些值已顯示,但您看不到。

我建議您使用weightsem屬性來控制布局的寬度。

嘗試下面的代碼,希望對您有用。

碼..

    <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