分享Android平板电脑上开发应用程序不能全屏显示的问题解决

2019/7/7 20:19:22

本文主要是介绍分享Android平板电脑上开发应用程序不能全屏显示的问题解决,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

本来LCD应该是800*600的,但总是得到600*600的结果。
经过好几天的努力,才解决:

复制代码 代码如下:

<http://schemas.android.com/apk/res/android>"
      package="myb.x2.app2"
      android:versionCode="1"
      android:versionName="1.0">

                          <android:screenOrientation="portrait"
                  android:label="@string/app_name">

     <android:normalScreens="true"
          android:smallScreens="true"
          android:anyDensity="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();
    }

}



这篇关于分享Android平板电脑上开发应用程序不能全屏显示的问题解决的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程