我们必须使用哪种布局来放置文本视图并在我们想要的android位置编辑文本?

时间:2011-07-16 09:06:11

标签: android layout

我们正在研究android项目。我们已经使用相对布局放置了背景图像。现在我们要用登录按钮放置用户名和密码。我们现在应该使用哪种布局?我们在保持那些处于我们要求的位置时面临一些问题。 我们需要设置哪些属性?请向我们发送示例代码。

由于

2 个答案:

答案 0 :(得分:0)

我认为RelativeLayout最符合您的要求..

all layout sample code

plz看到此链接尝试使用relativelayout实现。

property of relative layout

答案 1 :(得分:0)

首先,制作一个与此类似的布局xml。

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/marker_layout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</RelativeLayout>

之后,在该xml上实例化RelativeLayout

 RelativeLayout rl = (RelativeLayout) findViewById(R.id.marker_layout);

从现在开始,只需使用paramLayout将你的textview添加到rl。

RelativeLayout.LayoutParams param = new         RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
 param.leftMargin = your desired x coor;
 param.topMargin = your desired y coor;
 rl.addView(TextView,param);