android修改开机自动默认设置

1, MTK平台开机开机部分自动默认设置 
A,  开机自动默认打开gprs数据流,很多应用都需要自动开启这个,可以直接改 
alps\frameworks\base\telephony\java\com\android\internal\telephony\PhoneProxy.java文件的 在类public class PhoneProxy extends Handler implements Phone 中 直接修改 //cathon xiong 
    private boolean mGPRSOn = true;  默认true  
B, 修改WIFI开机自动激活,有的定位服务需要自动开启 
alps\frameworks\base\packages\SettingsProvider\res\values\defaults.xml 把下面这个选项设置为true 
<bool name="def_wifi_on">true</bool>  
C, 如何默认设置为百度输入法,也是上述文件 
alps\frameworks\base\packages\SettingsProvider\res\values\defaults.xml,修改比较复杂 把下面这条修改成 

<string name="default_input_method" translatable="false">com.baidu.input/.ImeService</string> 主要是要看懂package后面的是bindservice绑定的name,而不是activityname 


Android横屏竖屏设置

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);// 设置成全屏 模式

setRequestedOrientation( Activity Info.SCREEN_ORIENTATION_LANDSCAPE););//强制为横屏

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//竖屏

我做的东西里面还用到了去掉标题栏。
我也贴出来
requestWindowFeature(Window.FEATURE_NO_TITLE);

 

 

垂直居中: 

android:layout_centerVertical="true"

 

水平居中:

android:layout_centerHorizontal="true"

 

1.hideStatusbarAndTitlebar()隐藏statusbar和titlebar.


   
   
private void hideStatusbarAndTitlebar() {
final Window win = getWindow();
ndowManager.Layo
// No Statusbar
win.setFlags(W
iutParams.FLAG_FULLSCREEN,
ms.FLAG_FULLSCREEN); // No Titlebar requestWi
WindowManager.LayoutPar
andowFeature(Window.FEATURE_NO_TITLE);
}

2.设置屏幕显示模式ScreenOrientation.

在activity里设置android:screenOrientation的值。
android:screenOrientation的属性有以下值:
unspecified(默 认值,由系统判断状态自动切换),The default value. The system chooses the orientation. The policy it uses, and therefore the choices made in specific contexts, may differ from device to device.
landscape,横屏
portrait,竖屏
user(用户当前设置的orientation值),The user's current preferred orientation.
behind(下一个要显示的Activity的orientation值),The same orientation as the activity that's immediately beneath it in the activity stack.
sensor(传 感器的方向),The orientation determined by a physical orientation sensor. The orientation of the display depends on how the user is holding the device; it changes when the user rotates the device.
nosensor(不 使用传感器,这个效果差不多等于unspecified).An orientation determined without reference to a physical orientation sensor. The sensor is ignored, so the display will not rotate based on how the user moves the device. Except for this distinction, the system chooses the orientation using the same policy as for the "unspecified" setting.

3.水平/垂直居中的方法.

设置parent的android:gravity为"center"。

4.获得当前屏幕宽高的方法.


   
   
Display display = getWindowManager().getDefaultDisplay();
Config.screenWidth = display.getWidth();
;
Config.screenHeight = display.getHeight(
)

   
   
)




原文地址:http://wenku.baidu.com/view/5cc67a25ed630b1c59eeb533.html

http://www.pslib.com/index.php?mod=skill&action=detail&id=44068


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值