【发布时间】:2014-07-17 05:49:09
【问题描述】:
我想在我的应用程序中添加一个ImageView,然后将其设置为全屏。
我曾在 Android Studio 中尝试过以下代码。(我也在 Eclipse IDE 中尝试过)
我的最低要求
SDK:API 8:Android 2.2 froyo,
目标 SDK:API 19:Android 4.4 KitKat,
编译方式 : API 19:Android 4.4 KitKat,
语言级别 :6.0-ovrrride in interface,
主题 :Holo Light with Dark Action Bar。
那么在activity_main.xml中的代码如下:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.crystal.app.MainActivity">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_alignParentLeft="true"
android:src="@drawable/ddd" />
</RelativeLayout>
我将主题设置为Theme.Black.NoTitleBar.Fullscreen。
我更改了 AndroidManifest.xml 代码如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.crystal.app" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
<activity
android:name="com.example.crystal.app.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>
然后我在 AVD 中运行应用程序,但是当我打开应用程序时,它显示如下错误:
不幸的是,(应用名称)已停止(和确定按钮)
那么,我的代码有什么问题。
并告诉我有多少种方法可以做到这一点。 提前谢谢你。
【问题讨论】:
-
显示你的 logcat 错误...
-
man 显示 logcat 错误.....
-
你想做什么.....你想设置闪屏吗???你能多给点想法吗……也请在这里发布你的logcat……
-
正如我上面所说的不幸的是,当我运行应用程序时已停止并且没有发现 logcat 错误
-
如果没有有用的 logcat 条目,您将不会收到该错误。
标签: java android xml eclipse android-studio