【Android入门】控件布局与控件属性(长期更新)

安卓布局:

体现在Activity中:   1.View(android.view.View)

                                        

                                2.Groupview(android.view.GroupView)

                                        1.GroupView(逻辑)

                                                RadioView

                                                ScrollView

                                        2.Layout(可视化)

                                                FrameLayout;LinearLayout; 。。。
/**AndroidManifest.xml解释
 * <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mmciel.mytell"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="21"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        
        <activity
        
            android:name=""//activity名称 
            
            android:permission="" 权限
             
            //	如何激活activity:
             * 如果意图过滤器被匹配 那么activity激活
             * 
             * 
            android:theme=""
            android:configChanges="">
            
            //intent为意图,可以多个
            <intent-filter>意图过滤器
            	动作名称
                <action android:name="android.intent.action.MAIN" />
				类别
                <category android:name="android.intent.category.LAUNCHER" />
            	数据
            	//数据描述:URI:
            	 *tel:13654527666
                <data android:scheme=""/>
            </intent-filter>
 * */

android:layout_width="fill_parent"

android:layout_height="wrap_content"

1)fill_parent
设置一个构件的布局为fill_parent将强制性地使构件扩展,以填充布局单元内尽可能多的空间。==铺满父类
2) wrap_content 强制性地使视图扩展以显示全部内容。==包裹内容
3)match_parent
   Android2.2中match_parent和fill_parent是一个意思 .如果考虑低版本的使用情况你就需要用fill_parent了

android:gravity="center_horizontal" 内容居中显示
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/back"//添加背景图片 drawable文件中放置back.png作为背景图片
    tools:context="${relativePackage}.${activityClass}" >


猜你喜欢

转载自blog.csdn.net/f_zmmfs/article/details/80705149