[英]How to create fullscreen theme for ImageView in android?
我想将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,
主题 :带有黑暗动作栏的全息光。
然后在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中运行应用程序,但是当我打开应用程序时,它显示如下错误:
不幸的是,(应用名称)已停止(和“确定”按钮)
所以,我的代码有什么问题。
并告诉我有多少种方法可以做到这一点。 先感谢您。
正如我上面提到的,我的最低要求sdk是不支持的Android 2.2 froyo
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
只有14以上的api级别(Icecream Sandwitch)支持它,因此我的最低要求sdk应该是Android 4.0或Android API级别应该大于或等于14。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.