Java 如何将所有用户安装的应用程序加载到gridview中,并使其在android中可点击
我正在制作一个android启动器,我需要知道如何将所有应用程序加载到gridview中。我希望系统的东西,如计算器和所有的,以显示以及。我该怎么做?我已经寻找了很长时间,现在没有任何解决办法。请帮助我,非常感谢 Java代码:Java 如何将所有用户安装的应用程序加载到gridview中,并使其在android中可点击,java,android,gridview,Java,Android,Gridview,我正在制作一个android启动器,我需要知道如何将所有应用程序加载到gridview中。我希望系统的东西,如计算器和所有的,以显示以及。我该怎么做?我已经寻找了很长时间,现在没有任何解决办法。请帮助我,非常感谢 Java代码: package com.mysoftware.mysoftwareos.launcher; import java.util.List; import android.app.Activity; import android.app.ActivityManager;
package com.mysoftware.mysoftwareos.launcher;
import java.util.List;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.GridView;
import android.widget.LinearLayout;
public class AllAppsActivity extends Activity {
LinearLayout allappsLayout;
GridView allappsGridView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.allapps_screen);
//Import views
allappsLayout = (LinearLayout)findViewById(R.id.allappsLayout);
allappsGridView = (GridView)findViewById(R.id.allappsGridView);
//Setup animation for the main layout
Animation a = AnimationUtils.loadAnimation(this, R.anim.fadeout);
a.reset();
allappsLayout.clearAnimation();
allappsLayout.startAnimation(a);
//Load all apps into the apptray
}
}
我的xml布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/allappsLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/wallpaper"
android:orientation="vertical" >
<GridView
android:id="@+id/allappsGridView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="3" >
</GridView>
</LinearLayout>
ADW.Launcher是一款开源的android启动器
浏览:是的,但是那里有很多乱七八糟的代码,我真的不喜欢在里面挖一个小时,然后不得不尽我所能在我的新启动器上实现它,我的启动器是完全不同的类型。我需要一些答案告诉我如何添加到我的感觉懒惰这个啊?看看这个:在这个问题上你还需要帮助吗?