zoukankan      html  css  js  c++  java
  • Layouts

    Layouts
      Each layout file must contain exactly one root element, which must be a View or ViewGroup object.

      After you've declared your layout in XML, save the file with the .xml extension, in your Android project's res/layout/ directory, so it will properly compile.

      When you compile your application, each XML layout file is compiled into a View resource. You should load the layout resource from your application code, in your Activity.onCreate()callback implementation. Do so by calling setContentView(), passing it the reference to your layout resource in the form of: R.layout.layout_file_name. For example, if your XML layout is saved as main_layout.xml, you would load it for your Activity like so:

      

      

      

      The at-symbol (@) at the beginning of the string indicates that the XML parser should parse and expand the rest of the ID string and identify it as an ID resource.

      The plus-symbol (+) means that this is a new resource name that must be created and added to our resources (in theR.java file).

      There are a number of other ID resources that are offered by the Android framework. When referencing an Android resource ID, you do not need the plus-symbol, but must add the android package namespace, like so:

      

      

    参考:http://android.xsoftlab.net/guide/topics/ui/declaring-layout.html#load

  • 相关阅读:
    HTML
    python io
    python 线程进程
    python socket
    python 面向对象2
    python 面向对象
    python hashlib模块
    python configparser模块
    python logging模块
    数组去重方法汇总
  • 原文地址:https://www.cnblogs.com/tekkaman/p/6263018.html
Copyright © 2011-2022 走看看