当前位置:  编程技术>移动开发
本页文章导读:
    ▪银幕尺寸和像素密度的资源限定符        屏幕尺寸和像素密度的资源限定符 屏幕尺寸和像素密度的资源限定符 以下是可以用来为不同的屏幕尺寸、像素密度和纵横比包含可替换资源的文件夹名称限定符 1、屏幕尺寸  small 小于标.........
    ▪ UNITY3D 惯用简单代码        UNITY3D 常用简单代码 01、基本碰撞检测代码function OnCollisionEnter(theCollision : Collision){ if(theCollision.gameObject.name == "Floor"){ Debug.Log("Hit the floor"); }else if(theCollision.gameObject.name == "Wall"){ Debu.........
    ▪ 设立firefox每次访问网页时检查所存网页的较新版本       设置firefox每次访问网页时检查所存网页的较新版本 在地址栏输入about:config回车找到browser.cache.check_doc_frequency选项,双击将3改成1       可以设置的值及其含义:0: Once per session  每个进.........

[1]银幕尺寸和像素密度的资源限定符
    来源: 互联网  发布时间: 2014-02-18
屏幕尺寸和像素密度的资源限定符

屏幕尺寸和像素密度的资源限定符

以下是可以用来为不同的屏幕尺寸、像素密度和纵横比包含可替换资源的文件夹名称限定符

1、屏幕尺寸  small 小于标准的3.2“的屏幕

                  medium 典型的智能手机的屏幕尺寸

                  large 比典型的智能手机的屏幕大得多的屏幕,比如平板电脑和上网本

2、像素密度  像素密度通常是用每英寸点数来计算

                  ldpi  用于为像素密度在100~140dpi之间的屏幕存储低密度资源

                  mdpi 用于像素密度在140~180dip之间的中等密度的屏幕

                  hdpi 用于像素密度在190~250dip之间的高密度的屏幕

                  nodpi 用于不管屏幕密度如何,都不能伸缩的资源

3、纵横比  屏幕的纵横比就是其高度和宽度的比率

                 long 用于横向模式的宽度比标准智能手机(如G1)的宽度大得多的屏幕

                 notlong 用于具有典型智能手机的纵横比的屏幕

具体描述如下表格:

 

每个限定符可以单独使用也可以和其他限定符一起使用

如 res/layout-small-long   //小而长的屏幕的布局

    res/layout-large            //大屏幕的布局

    res/drawable-hdpi         //高密度屏幕的 Drawable 

    res/layout/my_layout.xml             // layout for normal screen size ("default")
    res/layout-small/my_layout.xml       // layout for small screen size
    res/layout-large/my_layout.xml       // layout for large screen size
    res/layout-xlarge/my_layout.xml      // layout for extra large screen size
    res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

    res/drawable-mdpi/my_icon.png        // bitmap for medium density
    res/drawable-hdpi/my_icon.png        // bitmap for high density
    res/drawable-xhdpi/my_icon.png       // bitmap for extra high density

 Tip: If you have some drawable resources that the system should never scale (perhaps because you perform some adjustments to the image yourself at runtime), you should place them in a directory with the nodpi configuration qualifier. Resources with this qualifier are considered density-agnostic and the system will not scale them.

附:通过<supports-screens android:smallScreens="false" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"/>清单可以控制指定应用程序在哪些屏幕下运行

 

Declaring Tablet Layouts for Android 3.2

 

Screen configuration Qualifier values Description

smallestWidth(宽和高中比较小

的长度要比<N>大)

sw<N>dp

Examples:
sw600dp
sw720dp

The fundamental size of a screen, as indicated by the shortest dimension of the available screen area. Specifically, the device's smallestWidth is the shortest of the screen's available height and width (you may also think of it as the "smallest possible width" for the screen). You can use this qualifier to ensure that, regardless of the screen's current orientation, your application's has at least <N>dps of width available for it UI.

For example, if your layout requires that its smallest dimension of screen area be at least 600 dp at all times, then you can use this qualifer to create the layout resources, res/layout-sw600dp/. The system will use these resources only when the smallest dimension of available screen is at least 600dp, regardless of whether the 600dp side is the user-perceived height or width. The smallestWidth is a fixed screen size characteristic of the device; the device's smallestWidth does not change when the screen's orientation changes.

The smallestWidth of a device takes into account screen decorations and system UI. For example, if the device has some persistent UI elements on the screen that account for space along the axis of the smallestWidth, the system declares the smallestWidth to be smaller than the actual screen size, because those are screen pixels not available for your UI.

This is an alternative to the generalized screen size qualifiers (small, normal, large, xlarge) that allows you to define a discrete number for the effective size available for your UI. Using smallestWidth to determine the general screen size is useful because width is often the driving factor in designing a layout. A UI will often scroll vertically, but have fairly hard constraints on the minimum space it needs horizontally. The available width is also the key factor in determining whether to use a one-pane layout for handsets or multi-pane layout for tablets. Thus, you likely care most about what the smallest possible width will be on each device.

Available screen width

(宽度至少要比<N>大)

w<N>dp

Examples:
w720dp
w1024dp

Specifies a minimum available width in dp units at which the resources should be used—defined by the <N> value. The system's corresponding value for the width changes when the screen's orientation switches between landscape and portrait to reflect the current actual width that's available for your UI.

This is often useful to determine whether to use a multi-pane layout, because even on a tablet device, you often won't want the same multi-pane layout for portrait orientation as you do for landscape. Thus, you can use this to specify the minimum width required for the layout, instead of using both the screen size and orientation qualifiers together.

Available screen height

 

(高度至少要比<N>大)

 

h<N>dp

Examples:
h720dp
h1024dp
etc.

Specifies a minimum screen height in dp units at which the resources should be used—defined by the <N> value. The system's corresponding value for the height changes when the screen's orientation switches between landscape and portrait to reflect the current actual height that's available for your UI.

Using this to define the height required by your layout is useful in the same way as w<N>dp is for defining the required width, instead of using both the screen size and orientation qualifiers. However, most apps won't need this qualifier, considering that UIs often scroll vertically and are thus more flexible with how much height is available, whereas the width is more rigid.

 

To help you target some of your designs for different types of devices, here are some numbers for typical screen widths:

  • 320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
  • 480dp: a tweener tablet like the Streak (480x800 mdpi).
  • 600dp: a 7” tablet (600x1024 mdpi).
  • 720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).

 Caution: When developing for Android 3.2 and higher, you should not use the older screen size attributes in combination with the attributes listed above. Using both the new attributes and the older size attributes might cause unexpected behavior.


感谢http://www.cnblogs.com/cappuccino/archive/2011/08/08/2130982.html

    
[2] UNITY3D 惯用简单代码
    来源: 互联网  发布时间: 2014-02-18
UNITY3D 常用简单代码
01、基本碰撞检测代码

function OnCollisionEnter(theCollision : Collision){

if(theCollision.gameObject.name == "Floor"){

  Debug.Log("Hit the floor");

   }else if(theCollision.gameObject.name == "Wall"){

  Debug.Log("Hit the wall");

     }

  }


02、检测输入

function Update () {

          if(Input.GetButtonUp("Jump")){

              Debug.Log("We Have Hit the Space Bar!");

           }

      }


03、销毁对象

function Start () {

Destroy(gameObject.Find("Box"), 3);

}


04、实例来创建对象

//Simple Instantiation of a Prefab at Start

var thePrefab : GameObject;

function Start () {

var instance : GameObject = Instantiate(thePrefab, transform.position, transform.rotation);

}




建立JAVA,把代码拖入到空GameJect上,然后把Prefab拖入到公共变量上,就可以了

05、简易定时器

var myTimer : float = 5.0;

function Update () {

if(myTimer > 0){

  myTimer -= Time.deltaTime;

}

if(myTimer <= 0){

  Debug.Log("GAME OVER");

}

}


06、物体在屏幕上移动

var speed : float = 5.0;

function Update () {

transform.Translate(Vector3(0,0,speed) * Time.deltaTime);

}


07、钢体向目标处移动

//Basic force to move a rigidbody object

var power : float = 500.0;

function Start () {

rigidbody.AddForce(Vector3(0,0,power));

}


08、碰撞然后转到下一场景

function OnCollisionEnter (myCollision : Collision) {

if(myCollision.gameObject.name == "Floor"){

  Application.LoadLevel(myLevel);

}

}


floor---被动碰撞的的纲体

把代码拉到主动纲体上

然后

场景设置:file----build seting----对话框,然后把当前场景拖里,然后把下一场景拖里,测试OK

转至:http://www.web3d.com.cn/bbs/viewthread.php?tid=1457&extra=page%3D3

    
[3] 设立firefox每次访问网页时检查所存网页的较新版本
    来源: 互联网  发布时间: 2014-02-18
设置firefox每次访问网页时检查所存网页的较新版本
在地址栏输入about:config回车
找到browser.cache.check_doc_frequency选项,双击将3改成1


       可以设置的值及其含义:
0: Once per session  每个进程一次 每次启动Firefox时检查
1: Each time  每次访问此页时检查
2: Never  不检查
3: When appropriate/automatically 自动

    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3