我做了一个小应用程序,显示一些文本并在页面之间移动 我使用2.3.3 sdk 10版本,但现在当我在4.4.1手机中安装时,它的兼容性问题说不兼容的版本
package com.top20e1;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
public class TopActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
// requestWindowFeature(Window.FEATURE_NO_TITLE);
final Button switchact =(Button)findViewById(R.id.button1);
switchact.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent act2 = new
Intent(view.getContext(),secondactivity.class);
startActivity(act2);
}
});
}}
这是我应用中的典型布局
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/wood" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#171616"
android:text="management color"
android:textAppearance="?android:attr/textAppearanceLarge" />
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Previous" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="Next" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
这是我的明白
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="preferExternal"
package="com.top20e1"
android:versionCode="1"
android:versionName="1.0"
>
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/bg"
>
<activity
android:label="@string/app_name"
android:name=".Top20" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="secondactivity"
android:label="@string/app_name">
</activity>
<activity
android:name="thirdactivity"
></activity>
<activity
android:name="fourthactivity"
></activity>
<activity
android:name="fiveactivity"
></activity>
<activity
android:name="sixactivity"
></activity>
<activity
android:name="sevenactivity"
></activity>
<activity
android:name="eightactivity"
></activity>
<activity
android:name="nineactivity"
></activity>
<activity
android:name="tenactivity"
></activity>
<activity
android:name="elevenactivity"
></activity>
<activity
android:name="twevelactivity"
></activity>
<activity
android:name="thirteenactivity"
></activity> <activity
android:name="fourteenactivity"
></activity>
<activity
android:name="fifteenactivity"
></activity>
<activity
android:name="sixteenactivity"
></activity>
<activity
android:name="seventeenactivity"
></activity>
<activity
android:name="eighteenactivity"
></activity> <activity
android:name="nineteenactivity"
></activity>
<activity
android:name="twentyactivity" ></activity>
</application>
</manifest>
答案 0 :(得分:1)
这应该可行,只需在Android Manifest文件中添加。
<uses-sdk android:maxSdkVersion="19" />
4.4.1我认为对于KitKat来说,如果你想让你的应用程序兼容到目前为止Lollipop的最新版本,那么只需将maxSdkVersion设为22即可。