小编Tes*_*234的帖子

如何创建在Android中点击时不会消失的通知?

int icon = R.drawable.icon4;        
CharSequence tickerText = "Hello"; // ticker-text
long when = System.currentTimeMillis();         
Context context = getApplicationContext();     
CharSequence contentTitle = "Hello";  
CharSequence contentText = "Hello";      
Intent notificationIntent = new Intent(this, Example.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
Run Code Online (Sandbox Code Playgroud)

这对我不起作用.

我怎么能创建一个可点击的通知并转到我的应用程序,但点击后不会消失?

notifications android

11
推荐指数
2
解决办法
3万
查看次数

如何在Android SDK中启用/禁用3G/2G

我只是想知道如何使用Android SDK启用/禁用3G/2G,而不只是想要进入3G设置页面.谢谢.也有办法做同样的事情,但有GPS.谢谢!

android 3g

6
推荐指数
1
解决办法
7237
查看次数

如何制作一个体面的用户界面

我需要有关如何创建漂亮的用户界面的帮助.现在我想,看这个问题的人有一个机器人,如果是这样的话去市场.下载名为"快速设置"的应用.它有一个很棒的用户界面,我想学习如何使我的外观像那个一样好,如果你有任何帮助,我们将不胜感激.谢谢.

android android-ui android-layout

6
推荐指数
1
解决办法
1万
查看次数

如果选中了切换按钮

好吧,我想看看是否选中了复选框,但是我收到了错误.

定义复选框代码:

public class Preferences extends PreferenceActivity {

CheckBoxPreference togglePref;

...
}
Run Code Online (Sandbox Code Playgroud)

CheckBox代码:

public void checkNotify() {   

if (togglePref.isChecked()==(true)) {

...

   }

}
Run Code Online (Sandbox Code Playgroud)

OnCreate代码:

 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //SharedPreferences settings = getSharedPreferences("EasySettingsPreferences", MODE_PRIVATE);
    //boolean notify = settings.getBoolean("notify", false);

    checkNotify();
    rootView = new LinearLayout(this);
    rootView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

    rootView.setOrientation(LinearLayout.VERTICAL);

    togglePref =  new CheckBoxPreference(this);

    textView = new TextView(this);
    textView.setText(R.string.app_name);

    titleView = new LinearLayout(this);
    titleView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 26));
    titleView.setBackgroundResource(R.drawable.pattern_carbon_fiber_dark);

    titleView.addView(textView);
    preferenceView = new ListView(this);
    preferenceView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

    preferenceView.setId(android.R.id.list);
    PreferenceScreen screen = createPreferenceHierarchy();
    screen.bind(preferenceView); …
Run Code Online (Sandbox Code Playgroud)

android togglebutton

5
推荐指数
2
解决办法
3万
查看次数