2011-08-23 65 views
0

我已經搜索了所有答案,但提供的解決方案並未解決我的問題。在佈局上堆疊兩種不同尺寸的不同視圖

我有一個佈局,我顯示一些視圖(幾個按鈕和背景)。爲此我添加了一個自定義控件,我已經擴展了線性佈局。此控件顯示在佈局上方相當好。 我想要做的是添加一個額外的ImageView比這個控件大,但它會在它之前。

編輯:對不起,我希望這可以解決問題。

我有我的活動一個大的佈局(相對),我想在此佈局堆疊兩個額外的意見\佈局,最終版本將在圖片附:

enter image description here

這是我的佈局 - 它將imageview正確放置在菜單欄上,而不是其他菜單上。試圖把FrameLayout放到其他地方仍然沒有給我想要的結果。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@drawable/background"> 
    <RelativeLayout android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="450dip"> 
     <com.myproject.controls.SearchControl 
      android:id="@+id/scSearch" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
     /> 
     <ExpandableListView android:id="@+id/lstItems" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/scSearch" 
      android:layout_marginLeft="26dip" 
     /> 
    </RelativeLayout> 
    <FrameLayout android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 
    <com.myproject.controls.MenubarMain 
     android:id="@+id/mbMenuBarMain" 
     android:orientation="horizontal" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:gravity="bottom" 
    /> 
    <ImageView android:src="@drawable/myicon" 
       android:layout_width="200dip" 
       android:layout_height="200dip" 
       /> 
    </FrameLayout> 
</LinearLayout> 
+0

你的問題是? –

+0

@ Nathan-fig對不起,我添加了一些我想要的東西和我得到的一些概念圖像 – garkler

+0

你的問題不是很清楚。您只需添加2張圖片而無需任何解釋。只需添加一個圖像,你最終需要什麼。它可能會給你更多的答案。 – blessenm

回答

0

不確定這會起作用或不會導致我在工作時輸入這個信息。但這裏的故事道德習慣於使用RelativeLayout。你對佈局有更多的控制權。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@drawable/background"> 
    <com.myproject.controls.MenubarMain 
     android:id="@+id/mbMenuBarMain" 
     android:orientation="horizontal" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true"> 
    </com.myproject.controls.MenubarMain> 
    <com.myproject.controls.SearchControl 
     android:id="@+id/scSearch" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true"> 
    </com.myproject.controls.SearchControl> 
    <ExpandableListView android:id="@+id/lstItems" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/scSearch" 
     android:layout_above="@id/mbMenuBarMain" 
     android:layout_paddingLeft="26dp"/> 
    <ImageView android:src="@drawable/myicon" 
      android:layout_width="200dp" 
      android:layout_height="200dp" 
      android:layout_alignBottom="@id/mbMenuBarMain" 
      android:layout_alignRight="@id/mbMenuBarMain"/> 
</RelativeLayout> 
+0

令人驚訝的是,它一直是這樣一個簡單的答案..它的作品!謝謝! – garkler