2012-05-04 14 views
0

我想向用戶展示不同的元素。
因此,我想隱藏一些元素,而其他元素將顯示。
但是,替換的元素不能填滿原始區域。隱藏一些折扣時的補充版面

那麼有什麼方法可以替代它嗎?

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <VideoView 
     android:id="@+id/lesson_main_left_videoView" 
     android:layout_width="match_parent" 
     android:layout_height="0dip" 
     android:layout_weight="6" /> 

    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/lesson_main_left_LinearLayout" 
     android:layout_width="match_parent" 
     android:layout_height="0dip" 
     android:layout_weight="6" 
     android:orientation="horizontal" > 

     <EditText 
      android:id="@+id/lesson_main_left_record" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:editable="false" 
      android:ems="10" 
      android:singleLine="false" /> 

     <ListView 
      android:id="@+id/lesson_main_left_buddyList" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:animateLayoutChanges="true" /> 
    </LinearLayout> 

    <TableRow 
     android:id="@+id/lesson_main_left_tableRow1" 
     android:layout_width="match_parent" 
     android:layout_height="0dip" 
     android:layout_weight="1" > 

     <EditText 
      android:id="@+id/lesson_main_left_message" 
      android:layout_width="0dip" 
      android:layout_height="wrap_content" 
      android:layout_weight="4" > 
     </EditText> 

     <Button 
      android:id="@+id/lesson_main_left_send" 
      android:layout_width="0dip" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:text="SEND" /> 
    </TableRow> 

</LinearLayout> 

回答

1

是的,你可以做到這一點,利用

setVisibility(View.GONE) 

(而不是View.INVISIBLE)。