RelativeLayout réactualisation de la vue.setVisibility(View.DISPARU) et la vue.setVisibility(View.VISIBLE)

Veuillez jeter un oeil à l'image ci-dessous pour comprendre le problème:

RelativeLayout réactualisation de la vue.setVisibility(View.DISPARU) et la vue.setVisibility(View.VISIBLE)

Comme vous pouvez le voir, il y a un RelativeLayout qui détient une coutume View et un LinearLayout.
Entre eux, il y a aussi un autre View, qui Visibility est fixé à GONE.
Maintenant, lorsque j'appuie sur le Button, je voudrais changer la visibilité de cette GONE Vue de VISIBLE, et de réorganiser la RelativeLayout, de sorte que le troisième View obtient entre personnalisé View et LinearLayout. Lorsque j'appuie sur un autre bouton, je voudrais faire troisième point de vue reparti. Comment puis-je y parvenir?

Voici mon XML:

<view
android:id="@+id/CanvasView"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_above="@+id/HorizontalScrollView"
android:layout_centerHorizontal="true"
android:layout_margin="0dp"
android:layout_marginBottom="0dp"
android:layout_marginTop="0dp"
class="com.example.CanvasView"
android:orientation="vertical" />
<HorizontalScrollView
android:id="@+id/HorizontalScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/linearLayout2"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:visibility="gone" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:orientation="horizontal" >
//SOME BUTTONS HERE
</LinearLayout>
</HorizontalScrollView>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="5dp" >
<Button
android:id="@+id/button1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="0.4"
android:maxWidth="200dp"
android:text="Clear"
android:textColor="@android:color/white"
android:textSize="20sp" />
<Button
android:id="@+id/settingsButton"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_gravity="center_vertical|center_horizontal"
android:background="@drawable/settings_button_selector" />
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="0.4"
android:enabled="false"
android:maxWidth="200dp"
android:text="Recognize"
android:textColor="@android:color/white"
android:textSize="20sp" />
</LinearLayout>

Si je ne setVisibility de la troisième afficher dans le OnClick() la méthode, il apparaît au-dessus de LinearLayout et il va en surimpression de la Vue personnalisée (je l'ai essayé avant). En d'autres termes, il ne sera pas déplacer RelativeLayout.

OriginalL'auteur Marek | 2013-07-01