编程经验分享

笑看嫣红染半山,
逐风万里白云间,
逍遥此身不为客,
天地三才任平凡。

0%

如下,直接显示是不行的,只有通过handler显示才可以。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@Override
public void onCreate()
{
super.onCreate();
handler=new Handler(Looper.getMainLooper());
handler.post(new Runnable(){
public void run(){
Toast.makeText(getApplicationContext(), "Service is created!", Toast.LENGTH_LONG).show();
}
});
}
@Override
public void onStart(Intent intent,int startId)
{
super.onStart(intent, startId);
handler=new Handler(Looper.getMainLooper());
handler.post(new Runnable(){
public void run(){
Toast.makeText(getApplicationContext(), "Service is on!", Toast.LENGTH_LONG).show();
}
});
}
@Override
public void onDestroy(){
super.onDestroy();
handler=new Handler(Looper.getMainLooper());
handler.post(new Runnable(){
public void run(){
Toast.makeText(getApplicationContext(), "Service is off!", Toast.LENGTH_LONG).show();
}
});

  1. 把jar包和so库文件放入下图对应的文件夹中(这里需要在增加的jar上下文菜单中Add As Library一下);
    jar包和so文件的位置
  2. 配置AndroidManifest.xml中对应的service;
    AndroidManifest.xml中的service配置
  3. 设置权限;
    权限配置
    OK.

  • 问题一、如果让popupwindow自上而下弹出,自下而上退出,如果popupwindow不是在顶部和底部,而是上下有其他界面元素,怎么让popupwindow动画出去的部分隐藏在后面而不显示在前面?

  • 问题二、点击某个按钮弹出popupwindow的时候,该按钮是有点击声音的;弹出popupwindow后,焦点都转移到了popupwindow上,此时设置点击popupwindow外部可以取消该popupwindow,但是点击按钮也被认为是“点击popupwindow外部”,而不会出发按钮的OnClick事件,所以不会有click的声音,如何解决?

编辑区的光标跳转:

跳转到文件开头

mac: fn + command + 左箭头

跳转到文件结尾

mac: fn + command + 右箭头

跳转到当前显示区域开头

mac: fn + command + 上箭头

跳转到当前显示区域结尾

mac: fn + command + 下箭头

阅读全文 »