转自:http://blog.csdn.net/caiwenfeng_for_23/article/details/8373569

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world"
tools:context=".MainActivity" />

一直对于 tools:context=".MainActivity"这句不懂,今天查了下,发现是这样的:

tools:context="activity name"这一句不会被打包进APK。只是ADT的Layout Editor在你当前的Layout文件里面设置对应的渲染上下文,说明你当前的Layout所在的渲染上下文是activity name对应的那个activity,如果这个activity在manifest文件中设置了Theme,那么ADT的Layout Editor会根据这个Theme来渲染你当前的Layout。就是说如果你设置的MainActivity设置了一个Theme.Light(其他的也 可以),那么你在可视化布局管理器里面看到的背景阿控件阿什么的就应该是Theme.Light的样子。仅用于给你看所见即所得的效果而已。

tools:context=".MainActivity的作用 (转载)的更多相关文章

  1. Android tools:context=".MainActivity"的作用

    <TextView android:layout_width="wrap_content" android:layout_height="wrap_content& ...

  2. tools:context=".MainActivity的作用

    <TextView android:layout_width="wrap_content" android:layout_height="wrap_content& ...

  3. tools:context=".MainActivity的作用(转)

    android:layout_width="match_parent" android:layout_height="match_parent" android ...

  4. Android 之 tools:context和tools:ignore两个属性的作用

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools= ...

  5. 【转】Android tools:context

    tools:context="com.example.guolin.scrollertest.MainActivity" 有时候可以看到有这个东西,但是从来没有用过,不知道有什么作 ...

  6. xmlns:tools="http://schemas.android.com/tools"以及tools:context=".ConfActivity"是什么意思

    xmlns:tools="http://schemas.android.com/tools"这个是xml的命名空间,有了他,你就可以alt+/作为提示,提示你输入什么,不该输入什么 ...

  7. Spring 注解<context:annotation-config> 和 <context:component-scan>的作用与区别

    <context:annotation-config> 是用于激活那些已经在spring容器里注册过的bean(无论是通过xml的方式还是通过packagesanning的方式)上面的注解 ...

  8. spring <context:annotation-config/> 注解作用

    <context:component-scan>包含<context:annotation-config/>的作用 <context:annotation-config/ ...

  9. Spring中<context:annotation-config/>的作用

    spring中<context:annotation-config/>配置的作用,现记录如下: <context:annotation-config/>的作用是向Spring容 ...

随机推荐

  1. SQL SERVER 2012 第五章 创建和修改数据表 の CREATE语句

    CREATE <object type> <object name> CREATE DATABASE <database name> 比较完整的语法列表: 日志文件 ...

  2. python学习之-- RabbitMQ 消息队列

    记录:异步网络框架:twisted学习参考:www.cnblogs.com/alex3714/articles/5248247.html RabbitMQ 模块 <消息队列> 先说明:py ...

  3. Codeforces 653A Bear and Three Balls【水题】

    题目链接: http://codeforces.com/problemset/problem/653/A 题意: 给定序列,找是否存在连续的三个数. 分析: 排序~去重~直接判断~~ 代码: #inc ...

  4. Java的对象和类

    以下内容引用自http://wiki.jikexueyuan.com/project/java/object-classes.html: 一.概述 Java是一种面向对象的语言.作为一种具有面向对象特 ...

  5. 【Nginx】基本数据结构

    整型的封装 typedef intptr_t ngx_int _t;//有符号整型 typedef uintptr_t ngx_uint_t;//无符号整型 字符串的封装 typedef struct ...

  6. 【Nginx】定时器事件

    转自:烟雨江南 Nginx事件管理主要是网络事件和定时器事件.下面介绍定时器事件管理,即超时管理. 为什么进行超时管理? Nginx有必要对可能发生超时的事件 进行统一管理,并在事件超时时作出相应的处 ...

  7. ART虚拟机之Trace原理(转)

    一.概述 Android 6.0系统采用的art虚拟机,所有的Java进程都运行在art之上,当应用发生ANR(Application Not Response,其中最终的一个环节便是向目标进程发送信 ...

  8. android KE or NE分析

    使用arm-eabi-addr2line工具跟踪Android调用堆栈 在通常的C/C++代码中,可以通过响应对内存操作不当引起的Segmentation Fault错误即信号SIGSEGV(11)做 ...

  9. C语言 字符串操作 笔记

    /* C语言字符串的操作笔记 使用代码和注释结合方式记录 */ # include <stdio.h> # include <string.h> int main(void) ...

  10. HTML5_路径

    <!DOCTYPE html> <hmtl> <html  lang="zh-cn"> <head> <meta charse ...