菜鳥求助

mj_test 2011-08-04 03:07:17
今天頭一次接觸安卓

配置完了之後,新建了一個項目,參考網上的資料,在main.xml裏面添加了點文字



<?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" android:gravity="center_horizontal">
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="给小宝宝起个名字:" android:textSize="20px" android:textColor="#0ff" android:background="#333" />
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="遥遥是男孩的小名" android:textSize="20px" android:textColor="#0f0" android:background="#eee" android:layout_weight="3" />
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="瑶瑶是女孩的小名" android:textColor="#00f" android:textSize="20px" android:background="#ccc" android:layout_weight="1" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="海因是男孩的大名" android:textColor="#f33" android:textSize="20px" android:background="#888" android:layout_weight="1" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="海音是女孩的大名" android:textColor="#ff3" android:textSize="20px" android:background="#333" android:layout_weight="1" />
</LinearLayout>




運行之後怎麼沒有顯示出來?

還是顯示那模擬器默認的東西。。

應該怎樣操作


我就是 了新建AVD(android vitural device)
然後在Run Configuration 裏面添加
然後點擊run ...
...全文
66 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
lyclqq 2011-08-05
  • 打赏
  • 举报
回复
看一下你的java中有这条吗?
setContentView(R.layout.main)
新晋技术宅 2011-08-05
  • 打赏
  • 举报
回复
同是新手,来帮顶个~
rocky225 2011-08-05
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 aomandeshangxiao 的回复:]

引用 5 楼 roemin880405 的回复:

引用 2 楼 fylz1125 的回复:
你确定你调用了 setContentView(R.layout.main)吗


是啊~ 你确定吗?
[/Quote]

看下Activity中是不是调用了
傲慢的上校 2011-08-05
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 roemin880405 的回复:]

引用 2 楼 fylz1125 的回复:
你确定你调用了 setContentView(R.layout.main)吗


是啊~ 你确定吗?
[/Quote]
roemin 2011-08-04
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 fylz1125 的回复:]
你确定你调用了 setContentView(R.layout.main)吗
[/Quote]

是啊~ 你确定吗?
qiying1988 2011-08-04
  • 打赏
  • 举报
回复
去看logcat信息,找问题。
a383028663 2011-08-04
  • 打赏
  • 举报
回复
帮你测试过了,没有半点问题,那就是你点Run时候的一些操作错误吧


对你的项目点右键,然后指向Run As->Run Configuration->Browse选择你的项目->Target->在你要使用的AVD上打勾->Apply->Run


成功的话把分给我吧,缺分数请人帮忙啊。。。
大掌教 2011-08-04
  • 打赏
  • 举报
回复
你确定你调用了 setContentView(R.layout.main)吗
redoffice 2011-08-04
  • 打赏
  • 举报
回复
提供的信息太少。main.xml没问题,如果模拟器运行良好,显示hello_app的话应该 没有问题。

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧