2014-10-07 85 views

回答

0

已设置为内用线性布局的宽度和高度属性会导致为您解决问题。其实值显示,但不可见你。

我建议你使用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> 
+0

谢谢!它的工作现在 – 2014-10-07 03:57:26