【问题标题】:The Android Hello World app is zoomed in and blurry on my nexus 7Android Hello World 应用在我的 nexus 7 上放大并模糊
【发布时间】:2012-12-29 20:45:58
【问题描述】:

我正在开始 android 开发,我正在关注 developer.android.com 上的第一个培训指南。

我创建了一个这样的应用程序:

android create project --target <target-id> --name MyFirstApp \
--path <path-to-workspace>/MyFirstApp --activity MainActivity \
--package com.example.myfirstapp

当我在我的 nexus 7 上安装它时,它全部放大模糊。 我该如何解决这个问题?

【问题讨论】:

    标签: android screen-size


    【解决方案1】:

    之所以模糊,是因为该应用最初是为手机大小的设备创建的,当您在平板电脑上运行它时,该应用被放大以适应 7 英寸屏幕。

    【讨论】:

    • 通常在平板电脑的右下角有一个按钮可以让您拉伸或缩放以填充。选择stretch-to-fill,它应该可以消除模糊性。
    • 我想知道我可以在我的应用源代码中做些什么来修复它。
    • 如果您将 textview 指定为 &lt;TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/hello_world" /&gt; 并且在 java 文件中您所做的只是覆盖 onCreate 方法和 setContentView(R.layout.activity_main);,那么它没有理由不应该是模糊的。跨度>
    • @DrewLeSueur Glasses 也可能是一个解决方案。
    • 我想我真正的问题可能是stackoverflow.com/questions/14085922/…
    【解决方案2】:

    原来我需要在我的AndroidManifest.xml 中设置supports-screens

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.gpsinsight.gpsandroid"                                                             
          android:versionCode="1"
          android:versionName="1.0">
        <supports-screens
            android:smallScreens="true"
            android:normalScreens="true"        android:largeScreens="true"
            android:xlargeScreens="true" />
        <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
            <activity android:name="MainActivity"
                      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>
    </manifest>
    

    【讨论】:

      猜你喜欢
      • 2016-04-05
      • 1970-01-01
      • 1970-01-01
      • 2012-01-23
      • 1970-01-01
      • 2023-04-11
      • 2019-05-28
      • 2015-07-19
      • 1970-01-01
      相关资源
      最近更新 更多