《第一行代码--Android》阅读笔记之界面设计
1.单位dp、dip、sp、pt、px、in、mm
这里引用StackOverFlow上的一个解答:
- px is one pixel.
- sp is scale-independent pixels.
- dip is Density-independent pixels.( dip == dp is ture)


Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".
Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user's preference.
You would use
spfor font sizesdipfor everything else
android:id="@+id/input_message"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:hint="Type something"
android:id="@+id/send"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Send"
super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);ArrayAdapter<String> adapter = new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_list_item_1, data);ListView listView = (ListView) findViewById(R.id.list_view);listView.setAdapter(adapter);
《第一行代码--Android》阅读笔记之界面设计的更多相关文章
- 《第一行代码——Android》
<第一行代码——Android> 基本信息 作者: 郭霖 丛书名: 图灵原创 出版社:人民邮电出版社 ISBN:9787115362865 上架时间:2014-7-14 出版日期:2014 ...
- 历时一年,我的著作《第一行代码——Android》已出版!
前言 事实上我当初决定開始写博客的想法挺简单的,认为自己搞技术这么多年了,总应该要留下点什么.既然没能写出什么出色的应用,那至少也要留下点文字分享给大家,以指引在我后面的开发人员们,毕竟我也从前辈们的 ...
- 20172327 2018-2019-1 《第一行代码Android》第二章学习总结
学号 2017-2018-2 <第一行代码Android>第二章学习总结 教材学习内容总结 - 活动是什么: 活动(Activity)是最容易吸引用户的地方,它是一种可以包含用户界面的组件 ...
- 20172327 2018-2019-1 《第一行代码Android》第一章学习总结
学号 2018-2019-1 <第一行代码Android>第一章学习总结 教材学习内容总结 - Android系统架构: 1.Linux内核层 Android系统是基于Linux内核的,这 ...
- 第一行代码 Android 思维导图
第一行代码 Android 思维导图
- 晒订单赢图灵图书,《第一行代码——Android》福利活动劲爆来袭!
版权声明:本文出自郭霖的博客,转载必须注明出处. https://blog.csdn.net/sinyu890807/article/details/28863515 (已结束) 我的著作<第一 ...
- 第一行代码Android(第3版).pdf下载
2020年人民邮电出版社出版的图书 <第一行代码Android(第3版)>是2020年4月人民邮电出版社出版的图书,作者是郭霖. 封面: 内容简介: <第一行代码 Android 第 ...
- 第一行代码 Android 第二版到货啦
今日android第一行代码[第二版]已到,收获的季节到了 先看一下封面 书签: 以后就把空闲时间送给它吧 先来看一下本书的目录: 第1章 开始启程--你的第1行Android代码 第2章 先从看得到 ...
- 《第一行代码 android》 读书笔记:找出当前界面对应的Activity
在android开发中找出当前界面对应的Activity,步骤如下: 新建一个BaseActivity继承自Activity,然后在BaseActivity中重写onCreate()方法,通过getC ...
随机推荐
- [AIR] AS3.0设置屏保功能
package com.controls { import flash.desktop.NativeApplication; import flash.events.Event; import fla ...
- shell test -n -z
z --- zero 字符串长度为零 2)判断字符串 test –n 字符串 字符串的长度非零 test –z 字符串 ...
- SQL 去特殊字符
)) ) as begin declare @i int while patindex('%[^%@+*,=../_ <>''" ^0-9 ^a-Z ^''- ^吖-座]%' , ...
- (转)C# MD5
本文原地址:http://blog.csdn.net/zhoufoxcn/article/details/1497099 作者:周公 代码如下: using System; using System. ...
- EDS 14.0 dtc:commmand not found
EDS 14.0在生成dtb文件时,输入命令: dtc -I dts -O dtb -o soc_system.dtb soc_system.dts 出现错误: bash:dtc:command on ...
- MySQL数据库优化技术概述
对于一个以数据库为中心的应用,数据库的优化直接影响到程序的性能,因此数据库性能至关重要.一般来说,要保证数据库的效率,要做好以下几个方面的工作: 1. 数据库表设计: 表的设计合理化(符合3NF): ...
- vc 判断哪个按键 被按下 消息 按键 状态
测试Numlock 是否是亮的 环境控制台程序: #include "stdafx.h" #include <stdio.h> #include <conio.h ...
- vc 递归删除非空文件夹
我觉得这是一个非常不错的递归例子 头文件 #pragma once #include <atlstr.h> #include <io.h> #include <strin ...
- android menu 开发
menu 分类: 选项菜单(OptionsMenu) 上下文菜单(ContextMenu) 子菜单(SubMenu) 弹出菜单(Popup) 首先说 选项菜单(OptionsMenu) 一.方法介 ...
- 【转】WEB测试到移动测试的转换
移动互联网的发展毋庸置疑是必然的趋势,我们曾经传统WEB互联网测试的同学,也必然走上移动测试的道路,移动测试与pc测试到底需要怎样的思维转变才能更快的进入移动节奏呢?对比下WEB与移动的测试不同点: ...