我们正在研究android项目。我们已经使用相对布局放置了背景图像。现在我们要用登录按钮放置用户名和密码。我们现在应该使用哪种布局?我们在保持那些处于我们要求的位置时面临一些问题。 我们需要设置哪些属性?请向我们发送示例代码。
由于
答案 0 :(得分:0)
我认为RelativeLayout最符合您的要求..
plz看到此链接尝试使用relativelayout实现。
答案 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);