[英]Content inside linear layout is not showing
我试图在线性布局内生成表格布局,而我在第二个布局内放置的任何内容均未显示。 我正在尝试做这样的事情:
设置为内部线性布局的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.