2012-06-27 57 views
0

两帧我想这个图像显示在同一个窗口

enter image description here

Frame 1在设计布局就像是灰色的,他Frame 2是透明的。我认为我们需要使用FrameLayout,但我不知道如何使用它。

回答

0

事实上,您可以使用FrameLayoutRelativeLayout(至少对于Frame 1),但是您没有说明您要如何处理这些帧(这会改变一点)。我会用一个RelativeLayout,因为我猜你会在第1帧的内容除了框架2:

<RelativeLayout android:id="@+id/frame1" android:background="#c1c1c1"// other attributes> 
    <FrameLayout android:id="@+id/frame2" android:layout_centerInParent="true" 
     android:background="@android:color/transparent"// other attributes /> 
</RelativeLayout> 
0

的一种方式可以是:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#c0c0c0" > 

    <LinearLayout 
     android:layout_width="200dp" 
     android:layout_height="100dp" 
     android:layout_centerInParent="true" 
     android:background="#ffffff" 
     android:gravity="center" > 
    </LinearLayout> 

</RelativeLayout> 
+0

谢谢,我会试试:) –

0

可以使用不作出上述像屏幕两个框架,因为它是不可能把一帧到另一帧的布局,这样你就可以通过其他方式,比如让用户,需要一个相对布局,把框架内的像,

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/relativeLayout1" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="@color/black" > 

     <FrameLayout 
      android:id="@+id/frameLayout1" 
      android:layout_width="250dp" 
      android:layout_height="100dp" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="180dp" 
      android:background="@color/tbl_green"> 
     </FrameLayout> 

    </RelativeLayout> 

可能是这可以帮助你。