小编Meh*_*dad的帖子

Android ShowCaseView的buttonLayoutParams不起作用

我在我的应用程序中使用ShowCaseView库.我想将"确定"按钮移到左侧.我使用了这段代码(在库中也一样):

// The following code will reposition the OK button to the left.
RelativeLayout.LayoutParams lps = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
lps.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
int margin = ((Number) (getResources().getDisplayMetrics().density * 12))
        .intValue();
lps.setMargins(margin, margin, margin, margin);
View showcasedView = findViewById(R.id.ib_next);
ViewTarget target = new ViewTarget(showcasedView);
ShowcaseView.ConfigOptions co = new ShowcaseView.ConfigOptions();
co.buttonLayoutParams = lps;
co.fadeInDuration = 1000;
co.fadeOutDuration = 1000;
ShowcaseView sv = ShowcaseView.insertShowcaseView(target, this,
        R.string.showcase_title, R.string.showcase_details, co);
Run Code Online (Sandbox Code Playgroud)

但它不起作用?任何人都可以告诉问题在哪里?

android showcaseview

7
推荐指数
1
解决办法
1477
查看次数

耳机按钮双击android

我使用此代码检测我的广播接收器中的单击和双击耳机按钮:

int d = 0;
@Override
public void onReceive(Context context, Intent intent) {
    String intentAction = intent.getAction();
    if (!Intent.ACTION_MEDIA_BUTTON.equals(intentAction)) {
        return;
    }
    KeyEvent event = (KeyEvent) intent
            .getParcelableExtra(Intent.EXTRA_KEY_EVENT);
    if (event == null) {
        return;
    }
    int action = event.getAction();
    switch (event.getKeyCode()) {
        case KeyEvent.KEYCODE_HEADSETHOOK:
            if (action == KeyEvent.ACTION_DOWN) {
                d++;
                Handler handler = new Handler();
                Runnable r = new Runnable() {                   
                    @Override
                    public void run() {
                        Toast.makeText(context, "single click!", Toast.LENGTH_SHORT).show();
                        d = 0;
                    }
                };
                if (d == 1) { …
Run Code Online (Sandbox Code Playgroud)

java android double-click broadcastreceiver

4
推荐指数
1
解决办法
3224
查看次数

如何使用LoadLibrary()和GetProcAddress()函数将ntdll.dll添加到项目库?

我想得到线程的起始地址NtQueryInformationThread,但我需要添加它的库.我怎样才能做到这一点?

c windows nt winapi

3
推荐指数
1
解决办法
2600
查看次数