1.android:screenOrientation="portrait",表示当切换横竖屏的时候,屏幕的内容始终以竖屏显示,而不会根据屏幕的方向来显示内容. 2.插入个Android Studio永久显示行数小技巧:目前我用的是Android Studio 1.5,低版本和高版本设置略有不同,百度搜的大部分是以前版本的,所以还是力推Google.如下图:…
当在AndroidManifest.xml文件中定义了android:screenOrientation="portrait",就表示当我们切换横竖屏的时候,屏幕的内容始终以竖屏显示,而不会根据屏幕的方向来显示内容 AndroidManifest.xml文件 <?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.and…
Activity: android:screenOrientation 横(landscape)竖(portrait)屏显示. 如果想让它一直是横屏显示的话,xml:android:screenOrientation="landscape",     如果想让它一直是竖屏显示的话,xml:android:screenOrientation="portrait", 注:横竖屏切换后Activity会重新执行onCreat函数,但是在Android工程的Mainfest…
在开发android的应用中,有时候需要限制横竖屏切换,只需要在AndroidManifest.xml文件中加入android:screenOrientation属性限制.    android:screenOrientation="landscape"是限制此页面横屏显示,            android:screenOrientation="portrait"是限制此页面数竖屏显示.   Android:screenOrientation设定该活动的方向,…
今天工作中发现一个activity的android:screenOrientation属性设置为behind,平时经常看到的是landscape.portrait,一时没有反应过来,故查了一下android:screenOrientation支持的属性. 众所周知,Android应用程序中,android:screenOrientation用于控制activity启动时方向,取值可以为: unspecified,默认值,由系统决定,不同手机可能不一致 landscape,强制横屏显示 portr…
在Android的官方文档当中,对android:screenOrientation的说明如下: http://www.cnblogs.com/snowberg/archive/2012/07/15/2618908.html android:screenOrientationThe orientation of the activity's display on the device. The value can be any one of the following strings: "uns…
android:screenOrientationThe orientation of the activity's display on the device. The value can be any one of the following strings: "unspecified" The default value. The system chooses the orientation. The policy it uses, and therefore the choic…
Activity在屏幕当中显示的方向.属性值可以是下表中列出的一个值: "unspecified" 默认值,由系统来选择方向.它的使用策略,以及由于选择时特定的上下文环境,可能会因为设备的差异而不同. "user" 使用用户当前首选的方向. "behind" 使用Activity堆栈中与该Activity之下的那个Activity的相同的方向. "landscape" 横向显示(宽度比高度要大) "portrait&…
1.AndroidManifest.xml: <activity> android:screenOrientation="portrait" ... 2.xx.java: <activity> android:screenOrientation="portrait" //如果是竖排,则改为横排;反之然 if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSC…
iOS: This is done using XCode project details (select the required orientation) Android: AndroidManifest.xml (android:screenOrientation=portrait)…
 Android中如何在ViewPager中使动态创建的ImageView铺满屏幕 最近在做东西的时候,有一个要求,就是把用于在ViewPager里面轮播的图片铺满屏幕,但是中间遇到的问题是,ImageView与屏幕之间总是有空隙,情况如下图所示: 当时第一反应时考虑用LayoutParam,可是几经尝试无果,后来在网上找到了解决方案,只要在创建ImageView的时候,把ImageView的属性ScaleType设为FIT_XY然后问题就解决了,具体的代码如下: 方案一: ImageView…
前言: 昨晚新版本终于发布了,但是还是记得有测试反馈app启动好长时间也没进入app主页,所以今天准备加个班总结一下App启动那些事! app的启动方式: 1.)冷启动      当启动应用时,后台没有该应用的进程,这时系统会重新创建一个新的进程分配给该应用,这个启动方式就是冷启动.冷启动因为系统会重新创建一个新的进程分配给它,所以会先创建和初始化Application类,再创建和初始化MainActivity类(包括一系列的测量.布局.绘制),最后显示在界面上. 2.)热启动      当启动…
activity生命周期 #Activity生命周期###void onCreate()* Activity已经被创建完毕###void onStart()* Activity已经显示在屏幕,但没有得到焦点###void onResume()* Activity得到焦点,可以与用户交互###void onPause()* Activity失去焦点,无法再与用户交互,但依然可见###void onStop()* Activity不可见,进入后台###void onDestroy()* Activi…
打开了.activityA,B,C,D,...然后到E一起关闭前面所有activity(转自:http://blog.csdn.net/lengguoxing/article/details/42145641)(详细:http://blog.csdn.net/u010205141/article/details/44153377) public class CacheActivity { public static List<Activity> activityList = new Linke…
默认情况下,Android APP的界面会随着手机方向的改变而改变,当手机处于竖屏状态,APP的界面也处于竖屏状态,而当手机处于横屏状态,APP也会自动切换到横屏状态.一般情况下APP的界面都是为竖屏设计的,一旦自动切换到横屏,界面可能就无法直视了.而且每次屏幕方向切换,当前的页面都会销毁并重新创建. 下面先做一个简单的演示 布局文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xml…
创建第二个Activity(掌握) 需要在清单文件中为其配置一个activity标签 标签中如果带有这个子节点,则会在系统中多创建一个快捷图标 <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-fil…
服务端: //CalculateInterface.aidl package com.itheima.aidl.calculate; interface CalculateInterface { double doCalculate(double a, double b); } //CalculateService.java package com.itheima.myaidl.server; import com.itheima.aidl.calculate.CalculateInterfac…
引言      现在APP开发集成分享功能已经是非常普遍的需求了.其他集成分享技术我没有使用过,今天我就来介绍下使用ShareSDK来进行分享功能开发的一些基本步骤和注意点,帮助朋友们避免一些坑.好了,下面切入正题正式开始介绍. 1.ShareSDK开发包及配置 这个不用多说,去他们官网看找SDK开发包和集成文档即可.Android版本地址:http://www.mob.com/downloadDetail/ShareSDK/android.注意:记得要注册ShareSDK账号获取AppKey哦…
Android EditText悬浮在输入法之上 使用 android:windowSoftInputMode="adjustResize" 会让界面整体被顶上去,很多时候我们不需要这样的情况出现,这里给出另一个方案. 思路:监听输入法的状态,然后动态的滚动 EditText 所在的 ViewGroup 或者View 1. Android Manifest.xml <activity android:name=".InputActivity" android:…
1. 在onCreate()中获取NfcAdapter对象: NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this); 2.在onNewIntent()中获取Tag对象或者NdefMessage信息: 获取Tag对象: Tag tag = intent.getParcelableExra(NfcAdapter.EXTRA_TAG); 获取NdefMessage信息: Parcelable[] rawMsgs = getIntent()…
Android支持的数据格式 数据格式的Intent filter AndroidManifest.xml文件中,要像向下列示例那样,在<activity>元素内的<meta-data>元素中指定你创建的资源文件: <activity> ... <intent-filter> <action android:name="android.nfc.action.TECH_DISCOVERED" /> </intent-fil…
http://blog.csdn.net/zhyl8157121/article/details/8169172 目录(?)[-] 项目说明 开发环境的部署 数据库设计 服务器端程序设计Webservice 客户端android端程序设计 本文为原创,如果转载请注明出处 http://blog.csdn.net/zhyl8157121/article/details/8169172 其实之前发过一篇这样的博文http://blog.csdn.net/zhyl8157121/article/det…
onConfigurationChanged 不生效问题解决方案: 1).首先,需要重写onConfigurationChanged函数 @Override    public void onConfigurationChanged(Configuration newConfig) {        super.onConfigurationChanged(newConfig);        //do something    } 2). 需要在AndroidManifest.xml的Acti…
一.禁止横竖屏转换 Android横竖屏切换在手机开发中比较常见,很多软件在开发过程中为了避免横竖屏切换时引发不必要的麻烦,通常禁止掉横竖屏的切换, 通过在AndroidManifest.xml中设置activity中的android:screenOrientation属性值来实现. 比如下列设置 android:screenOrientation="portrait" 则无论手机如何变动,拥有这个属性的activity都将是竖屏显示. android:screenOrientatio…
Android四大组件:Activity,Service,Broadcast Receiver,Content Provider Activity是Context的子类,同时实现了Window.Callback和KeyEvent.Callback接口,可以处理用户与窗体交互的事件. 创建Activity 定义一个XxxActivity类继承Activity,并重写onCreate() 在onCreate()中通过setContentView()加载该Activity的布局文件 在清单文件中配置a…
眨眼间,已经到了2016你年春节前,离上一篇博客的时间已经有6个月多,回想起这半年的种种,不得不说,学习和工作实在是太忙了,或许这就是程序员的真实写照吧. 写博客之初,主要的目的还是为了把自己的学习痕迹记录下来,写的东西比较基础,也不多,算是一种督促,希望能坚持地学习下去,因为学识不存在暴发户,靠的 是积累.如果对自己过去半年的学习给个评价,我还是比较满意的,前期定下来的目标都基本都达到了.单凭这个,我就觉得今年的新年会是个好年. 说完过去,那么接着就是将来.因为现在的工作环境上外网不大方便,而…
1.需求 弹出提示的dialog,实现倒计时,结束后关闭dialog 2.dialog界面布局 <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="500dp" android:layout_hei…
1.android string.xml 文字中间加入空格 android string.xml前后加空格的技巧 <string name="password">密    码</string> &#160 这个就代表着空格 2.文字单行显示 android layout布局文件中TextView.EditView单行显示和输入 <TextView android:singleLine="true"/>:文本单行显示 <…
第一,横竖屏切换连带横竖屏布局问题: 如果要让软件在横竖屏之间切换,由于横竖屏的高宽会发生转换,有可能会要求不同的布局. 可以通过以下两种方法来切换布局: 1)在res目录下建立layout-land和layout-port目录,相应的layout文件名不变,比如:layout-land是横屏的layout,layout-port是竖屏的layout,其他的不用管,横竖屏切换时程序调用Activity的onCreate方法中的setOnContent(xxx),并自动加载相应的布局. 2)假如布…
主要存在于res/value文件夹中 定义: dimen.xml:主要用于设置像素默认值 <resources> res/values/dimens.xml <dimen name="sp_12">12sp</dimen><dimen name="sp_13">13sp</dimen> <dimen name="dip_40">40dip</dimen> <…