2012-12-04 22 views
1

我有一個RelativeLayout1大約一半的屏幕寬度最初設置爲GONE ..另一個佈局RelativeLayout2必須將屏幕寬度設置在左邊。 。根據我設置RelativeLayout1可見性它應該設置RelativeLayout2向左移位,而不是將RelativeALyout2擠壓到左邊的屏幕寬度。可見RelativeLayout與GridView和按鈕擠壓當一個失敗的佈局是可見的

<RelativeLayout 
    android:id="@+id/fullScreen" 
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent" > 

    <RelativeLayout 
     android:id="@+id/menulayout" 
     android:layout_width="200dp" 
     android:layout_height="fill_parent" 
     android:layout_alignParentRight="true" > 

     <RelativeLayout 
      android:id="@+id/topMenubar" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:background="@drawable/slider_header" 
      android:fitsSystemWindows="true" > 

      <TextView 
       android:id="@+id/menu" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_centerVertical="true" 
       android:layout_marginLeft="5dp" 
       android:text="@string/menu" 
       android:textColor="#787878" > 
      </TextView> 
     </RelativeLayout> 

     <ListView 
      android:id="@+id/menulist" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_below="@id/topMenubar" 
      android:background="#232323" 
      android:cacheColorHint="#00000000" 
      android:divider="#5b5b5b" 
      android:dividerHeight="1dp" 
      android:scrollbars="none" /> 

     <Button 
      android:id="@+id/backmenu" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_centerVertical="true" 
      android:background="@drawable/arrowleft" /> 
    </RelativeLayout> 

    <RelativeLayout 
     android:id="@+id/maingridlayout" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_toLeftOf="@id/menulayout" > 

     <RelativeLayout 
      android:id="@+id/topBar" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true" 
      android:background="@drawable/header_bg" 
      android:fitsSystemWindows="true" > 

      <ImageView 
       android:id="@+id/handle" 
       android:layout_width="wrap_content" 
       android:layout_height="fill_parent" 
       android:layout_alignParentRight="true" 
       android:layout_centerVertical="true" 
       android:src="@drawable/handle" /> 

      <TextView 
       android:id="@+id/notificationnumber" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentRight="true" 
       android:background="@drawable/redbatch" 
       android:gravity="center" 
       android:textColor="#ffffff" 
       android:textSize="20dp" 
       android:visibility="gone" /> 

      <ImageView 
       android:id="@+id/searchnow" 
       android:layout_width="wrap_content" 
       android:layout_height="fill_parent" 
       android:layout_alignParentLeft="true" 
       android:layout_centerVertical="true" 
       android:src="@drawable/searchunsel" /> 

      <RelativeLayout 
       android:id="@+id/logolayout" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_centerInParent="true" 
       android:layout_toLeftOf="@id/handle" 
       android:layout_toRightOf="@id/searchnow" > 

       <com.drona.custom.ImageThumbLayout 
        android:id="@+id/logo" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerInParent="true" > 
       </com.drona.custom.ImageThumbLayout> 
      </RelativeLayout> 
     </RelativeLayout> 

+0

後你有佈局文件。 – Luksprog

+0

不要使用能見度=「去」,而不是它,如果有必要,然後使用可見性=「不可見」 –

回答

0

OKK我did..I拿了Horizo​​ntallScrollView與menyLayout可見和可滾動的假...然後當我必須使它可見滾動視圖使用

scrollTo(int x,iny y); 

或者我能做些什麼,我會addmenuLayout的mainGridLayout即以上;添加其他孩子mainGridLAyout

+1

請使用您問題上的編輯鏈接添加更多信息。後回答按鈕應該只用於問題的完整答案。 – Toto

+0

這不提供問題的答案。要批評或要求作者澄清,請在其帖子下方留言。 – Pfitz

0

的android:layout_width = 「FILL_PARENT」

你可以嘗試改變這個我猜

+1

沒有它不會工作...它需要屏幕寬度...我需要我的全屏擴展screenWidth + 200 – sheetal

+0

嗯我明白給我一個秒以正確查看您的代碼。 – nomad