我的位置: 首页 >> App >> App知识

Android “四分之一”屏实现

033        initView();

034        getScreenWidth();

035    }

036     

037    private void initView(){

038        findViewById(R.id.button1).setOnClickListener(this);

039        findViewById(R.id.button2).setOnClickListener(this);

040        findViewById(R.id.button3).setOnClickListener(this);

041        findViewById(R.id.button4).setOnClickListener(this);

042        mContentView = (LinearLayout) findViewById(R.id.content_layout);

043        mContentViewParent = (LinearLayout)findViewById(R.id.content_layout_parent);

044    }

045     

046    /**获取屏幕宽度*/

047    private void getScreenWidth(){

048        DisplayMetrics metric = new DisplayMetrics();

049        getWindowManager().getDefaultDisplay().getMetrics(metric);

050        mSreenWidth = metric.widthPixels;     // 屏幕宽度(像素)

翻页: 1 2 3 4 5 6 7

App知识

客户中心

版权2005-2020    聚卓网络有限公司    电话:18589057325    QQ:2338754269   粤ICP备14021702号

地址:深圳市宝安区 37区龙井一路100号 新乐社区工作站办公大楼侧门6楼(近翻身路、新乐社区健康服务中心)

技术支持: 网站建设