android - 更改 Android 的用户界面

标签 android user-interface

在 Android 中,如何用我自己的界面替换模拟器的用户界面?我想在模拟器启动时立即启动我自己的界面,用户不能使用原来的界面,但原来的界面在后台。

更新:

现在我的代码是这样的:

public class NewHomeScreen extends Activity {
/** Called when the activity is first created. */
@Override public void onCreate(Bundle state) {
    super.onCreate(state);
    setContentView(R.layout.main);
    Intent mainIntent = new Intent(this,Hello.class);
    startActivity(mainIntent);
    }
}

当我运行程序时,Eclipse 显示

ActivityManager:警告:Activity 未启动,它的当前任务已被带到最前面

有人知道为什么吗?

最佳答案

我想你的意思是你想创建一个可以设置为默认的替代 Home 应用程序。

您需要在 AndroidManifest.xml 中添加如下内容:

    <activity android:name="Home"
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME"/>
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

如果您查看 Android SDK 的示例文件夹,您会发现一个示例 Home 应用程序可能对您有所帮助。在 Android 1.6 SDK 中,它位于/android-sdk-linux_x86-1.6_r1/platforms/android-1.6/samples/Home

您还可以在Android 源here 中查看 native Android Home 应用程序的源代码。 .

关于android - 更改 Android 的用户界面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1491428/

相关文章:

c++ - Vista 窗口标题中的图片(标识)

javascript - 单击以在两个列表之间交换元素

android - findViewById 与 Activity 中的本地引用

android - Android 运行时中的水平和垂直 ScrollView

android - RealmResults findAllAsync() 不返回任何内容

java - 如何在Service中访问FragmentManager?

php - 如何在多个表中添加/编辑/管理相关数据

android - 在嵌套 fragment 中运行多个 AsyncTasks 时挂起线程,这会使应用变慢

java - 无法显示来自 JSONData 的 Json 数组值

android - itext pdf 生成器是 android 的开源库吗?