android开发怎么把线性布局改为相对布局?

【Main.axml】代码:<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="http://... 【Main.axml】代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/myButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>
【MainActivity】代码:

using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace c9
{
[Activity (Label = "c9", MainLauncher = true)]
public class MainActivity : Activity
{
int count = 1;

protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);

// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);

// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button> (Resource.Id.myButton);

button.Click += delegate {
button.Text = string.Format ("{0} clicks!", count++);
};
}
}
}
展开
 我来答
百度网友2725398
2015-08-11 · TA获得超过407个赞
知道小有建树答主
回答量:279
采纳率:40%
帮助的人:124万
展开全部

在Android中修改Activity的布局样式是在layout布局文件夹中通过修改布局文件的layout标签完成的

如下图所示:

只需将图中标识的LinearLayout标签改写成RelativeLayout就可以了!

水瓶座秦时明月
推荐于2017-09-08 · 超过32用户采纳过TA的回答
知道答主
回答量:53
采纳率:100%
帮助的人:53万
展开全部
直接在.xml文件中将
<LinearLayout></LinearLayout>
标签改为
<RelativeLayout></RelativeLayout>,

还有如果该标签中含有LinearLayout特有的属性时应将其删除
例如orientation属性是LinearLayout特有的属性,是不能出现在RelativeLayout标签中的。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
再改名我发火
2013-10-05 · TA获得超过189个赞
知道答主
回答量:128
采纳率:0%
帮助的人:129万
展开全部
把<LinearLayout></LinearLayout>改为<RelativeLayout></RelativeLayout>
不就可以了么。
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友f33ead1
2015-08-12 · TA获得超过108个赞
知道小有建树答主
回答量:208
采纳率:0%
帮助的人:68.5万
展开全部
右键layout,点new,选择 android XML file ,默认就是Linearlayout
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
帐号已注销
2015-08-22 · TA获得超过213个赞
知道小有建树答主
回答量:227
采纳率:0%
帮助的人:92.8万
展开全部
直接在布局文件中把LinearLayout改为RelativeLayout就可以了
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(4)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式