`
chenqiang5206
  • 浏览: 32602 次
  • 性别: Icon_minigender_1
  • 来自: 江西
社区版块
存档分类

adnroid 学习笔记(一)

阅读更多
今天开始学习android,在配置资源文件时遇到的问题,在这里总结一下;

  1.创建colors.xml文件,在设置drawable/color的值时,刚开始以颜色的值设定,如0xfffffff,始终报错,资源文件编译不通过,提示"string type is not allowed",后来查资料得到结果,设置drawable/color值时,需要以"#"号开头;
  举例:

 
Java代码  收藏代码

   <resources> 
          <color name="white">#fffffff</color> 
       </resources> 




  2.针对不同的layout,其layout top,left设值属性也不一样

   LinearLayout分别是android:layout_marginTop,android:layout_marginLeft

   AbsoluteLayout分别是android:layout_x,android:layout_y

Android SDK Version:2.2

1、Android图标等资源不能掺杂有大写字母(Invalid file name:must contain only [a-z0-9])

例如:testLogo.png是通不过的,正确的应该是testlogo.png

2、以下代码如果不设置layout_width跟layout_height,则运行会报错
    <TextView  
       android:layout_width="wrap_content"  
       android:layout_height="wrap_content"/>  

3、设置Application  无标题栏
 
<Application
android:theme="@android:style/Theme.NoTitleBar"/> 

  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics