Android 学习笔记1

          Eclipse+ADT+sdk 平台搭建好后,新建工程,使用安卓虚拟设备管理新建了模拟器,运行工程,结果模拟器死机了,经过查找,发现工程使用的设备和模拟器里的设备不一致,改过来后,出现了HELLOW WORLD!这才算是真正搭建好了。

        在学习线性布局时 ,又遇到了警告 

android:text="Button1"

提示是要@string.

<string name="Button1">按钮1</string> 
在string.xml添加上面资源,在布局中修改为
android:text="@string/Button1"

警告消失。

       线性布局比较简单,如果放置几行或几列的话,要使用线性布局嵌套了,然而复制了代码后,提示错误“Unexpected namespace prefix "xmlns" found for tag LinearLayout”,

网上查到删除嵌套里的

xmlns:android=<a target=_blank href="http://schemas.android.com/apk/res/android">http://schemas.android.com/apk/res/android</a>

就OK了。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" 
    android:layout_width="match_parent"
    android:layout_height="match_parent"    
    >

    <Button android:id="@+id/Button1"           
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"             
            android:text="@string/Button1"
                       
            /> 
    
    <LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"    
    >
    
    <Button android:id="@+id/Button2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/Button2" 
    android:layout_weight="1"
    /> 
    <Button android:id="@+id/Button3" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/Button3" 
    android:layout_weight="1" 
    /> 
    <Button android:id="@+id/Button4" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/Button4" 
    android:layout_weight="1" 
    />    
 </LinearLayout>
</LinearLayout>



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值