Android手机或Android平板电脑 应用不能全屏显示,解决方案!

方法一:<uses-sdk android:minSdkVersion="3" />提升SDK到4.

前些日子,客户反应客户端不能全屏显示(大屏幕手机),我觉得不太可能,结果使用模拟器模拟发现确实存在此问题,在google和baidu也没有找到解决此方面的方法,问了些朋友也没有解决,最好仔细发现问题出在......

对于Android手机或Android平板电脑,如果出现不能全屏显示,但layout中又使用如下方法布局也不用全屏显示

android:layout_width="fill_parent" android:layout_height="fill_parent"

显示效果如下:

 解决方法:AndroidManifest.xml中

<uses-sdk android:minSdkVersion="3" />

把最小支持SDK的手机支持3以上,3对应是SDK1.5,设置为4:对应SDK为1.6,只要设置的值大于等于4时,都能显示全屏(备注:一定是layout中设置了fill_parent属性)   平板电脑中也是如此!

显示的效果:

原创作品,转载请注明出处,谢谢!


方法二:使用MAINIFEST配置的方法


在一个8寸屏的Android平板电脑上开发应用程序(游戏程序),开始的时候,总是不能全屏显示,也不知道怎么设置才可以。本来LCD应该是800*600的,但总是得到600*600的结果。经过好几天的努力,才解决:<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="myb.x2.app2"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".myactivity"
                          android:screenOrientation="portrait"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
  <supports-screens android:largeScreens="true"
          android:normalScreens="true"
          android:smallScreens="true"
          android:anyDensity="true" />
</manifest> 后面加的<supports-screens android:largeScreens="true".../>就可以解决这个问题了,不难理解,但找到这个问题的解决办法却花了我好长时间。 Activity中的代码:public class myactivity extends Activity {
        public myview v;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // setContentView(R.layout.main        ); 
        requestWindowFeature(Window.FEATURE_NO_TITLE);
                getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                                WindowManager.LayoutParams.FLAG_FULLSCREEN);
                // 获得屏幕宽和高
                WindowManager windowManager = getWindowManager();
                Display display = windowManager.getDefaultDisplay();
                int w = display.getWidth();
                int h = display.getHeight();
        v=new myview(this,w,h);
        setContentView(v);
        v.start();
    }
    
    
}


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值