我的布局结构是这样的的FrameLayout保证金不工作
LinearLayout
FrameLayout
ImageView
ImageView
FrameLayout
TextView
LinearLayout
我已经设置保证金的两个ImageView的这是内部的FrameLayout。但是FrameLayout页边距被丢弃,并且它总是将图像设置在左上角。如果我从FrameLayout更改为LinearLayout,则边距工作正常。如何处理这个?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/inner1"
>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:layout_width="24px"
android:layout_height="24px"
android:id="@+id/favicon"
android:layout_marginLeft="50px"
android:layout_marginTop="50px"
android:layout_marginBottom="40px"
android:layout_marginRight="70px"
/>
<ImageView
android:layout_width="52px"
android:layout_height="52px"
android:id="@+id/applefavicon"
android:layout_marginLeft="100px"
android:layout_marginTop="100px"
android:layout_marginBottom="100px"
android:layout_marginRight="100px"
/>
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/title"
android:layout_marginLeft="10px"
android:layout_marginTop="20px"
android:textColor="#FFFFFF"
android:textSize = "15px"
android:singleLine = "true"
/>
</LinearLayout>
它的作品,但它让我感到肮脏。我以为我逃过了CSS黑客的日子...... – erlando 2012-04-30 13:38:47
它的工作原理,想知道它是否是一个错误? – Johnny 2012-06-27 18:07:53
FrameLayout.LayoutParams.gravity在2.3中没有重力选项 – JPM 2012-07-13 17:13:49