Android:全屏RelativeLayout

时间:2011-05-10 13:45:55

标签: android android-layout android-relativelayout

我有这个自定义类......

public class DrawView extends ImageView

当我在setImageBitmap(bitmap)构造函数中设置DrawViewEditText后面的ImageView会在屏幕后面填充ImageViewEditText 如何更改布局以将ImageView置于<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.hasse.move.DrawView android:id="@+id/mainView" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/addtext" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_below="@+id/mainView" android:text="aaa" /> </RelativeLayout>

{{1}}

2 个答案:

答案 0 :(得分:1)

您可以通过顶部,底部,左侧,右侧的对齐方式将对象放置在RelativeLayout中,或者相对于另一个子视图使用

进行定位
  

机器人:layout_above = “@ + ID / addtext”

检入属性视图的所有布局选项。

您是否在构造函数中传递了属性集?像这样:

public DrawView(Context context, AttributeSet set) {
        super(context, set);

答案 1 :(得分:0)

你应该看一下ImageView中的android:scaleType属性:D

希望它有所帮助 JQcorreia