【发布时间】:2014-01-05 06:02:19
【问题描述】:
我没有 480x800 设备,所以我使用的是 genymotion 模拟器。 Nexus-S 的规格显示为 480x800,但当我在应用程序中获得屏幕尺寸时,它显示为 480x728?我想知道这是否是实际设备上也发生的事情,还是只是 genymotion 模拟器中的错误?
@Override
public void onClick( View view )
{
if ( view == null )
return;
View v1 = getActivity().findViewById( R.id.bg );
Toast.makeText( getActivity(), "height:" + v1.getHeight() + " width:" + v1.getWidth(), Toast.LENGTH_SHORT ).show();
}
我的 style.xml 中有这些
<item name="android:windowFullscreen">true</item>
<item name="android:windowNoTitle">true</item>
这是布局文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background" >
</RelativeLayout>
【问题讨论】:
-
你能把你得到屏幕尺寸的相关代码贴出来吗?
标签: android android-emulator genymotion