我们如何检测自定义屏幕类别中的Andr​​oid? [英] How can we detect custom screen category in android?

查看:130
本文介绍了我们如何检测自定义屏幕类别中的Andr​​oid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检测Android在特定活动中使用自定义屏幕类,我想以编程方式检测布局sw640dp,怎么能是这个achieved.We可以为小,中,大和放大器做相同的; XLARGE布局,但我不知道在这一个,请帮我this.Thanks。

I would like to detect custom screen category in android being used in the particular activity,I would like to detect layout-sw640dp programatically,how can be this achieved.We can do the same for small,normal,large & xlarge layouts but I am not sure on this one,kindly help me on this.Thanks.

推荐答案

不知道为什么你需要做的。但是,快速步行约是使用标签,例如:

Not sure why you need to do that. But, a quick walk-around is to use tag, for example:

在MDPI:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="@drawable/content_bg"
  android:orientation="vertical"
  android:id="@+id/name"
  android:tag="mdpi-xxx-yyy" >

在华电国际:

  android:id="@+id/name"
  android:tag="hdpi-xxx-yyy" >

然后,从code为R.id.name读取标签。

Then, read tag from your code for R.id.name.

这篇关于我们如何检测自定义屏幕类别中的Andr​​oid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆