3.App Resources-Resource Types/Layout Resource
1. Layout Resources
A layout resource defines the architecture for the UI in an Activity or a component of a UI.
2. Syntax
<?xml version="1.0" encoding="utf-8"?> <ViewGroup //A container for other View elements xmlns:android="http://schemas.android.com/apk/res/android" android:id="@[+][package:]id/resource_name" android:layout_height=["dimension" | "fill_parent" | "wrap_content"] android:layout_width=["dimension" | "fill_parent" | "wrap_content"] [ViewGroup-specific attributes] >
<View //An individual UI component, generally referred to as a "widget". android:id="@[+][package:]id/resource_name" android:layout_height=["dimension" | "fill_parent" | "wrap_content"] android:layout_width=["dimension" | "fill_parent" | "wrap_content"] [View-specific attributes] > <requestFocus/>//Any element representing a View object can include this empty element, which gives its parent initial focus on the screen. You can have only one of these elements per file. </View>
<ViewGroup > <View /> </ViewGroup>
<include layout="@layout/layout_resource"/>
</ViewGroup>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。