- 博客(21)
- 资源 (5)
- 收藏
- 关注
原创 指定按钮获取焦点
如何让指定的按钮获取焦点:先让其它按钮不可获取焦点:setFocusable(false)。然后让指定的按钮获取焦点:binding.btnEmptyShelves.setFocusableInTouchMode(true);binding.btnEmptyShelves.requestFocus();binding.btnEmptyShelves.setFocu...
2019-03-08 11:29:52
1314
原创 Android studio 类和gradle.build 显示不正确。
部分类文件变成了R类。部分gradle.build文件变成了XML文件。本地文件显示正常,但是在Android studio显示错乱。 解决方法:将Android Studio的设置恢复到初始化(清除所有的设置)删除c盘下的配置文件, 路径为C:\Users\用户名\.AndroidStudio1.2和C:\Users\用户名\.android两个文件夹...
2018-12-03 16:17:56
445
1
原创 update.setEnabled(true); update.isEnabled() 返回true , 但是UI没有改变
update.setEnabled(false); 的时候, @Override public void onClick(View v) { if (v.getId() == R.id.ibtn_update) { if (listener != null) { listener.onUpdate(); ...
2018-12-03 11:25:47
485
原创 国际化从服务器获取string.xml内容 要考虑的
1、/res 下面的内容不允许运行时修改;2、针对Android UI 生成特定的string文件;3、文字间的空格(比如:<string name="action_sign_in">登\u0020\u0020录</string>);4、字符串之间的占位符(比如:<string name="format_version">版本:%s</stri...
2018-10-18 13:59:42
364
原创 pda扫描枪 按enter键下一个view不能获取焦点
binding.btQuery.setFocusableInTouchMode(true);binding.btQuery.requestFocus();延迟获取焦点。/** * 请求焦点 */public static void requestFocus(final View view) { view.postDelayed(new Runnable() { ...
2018-10-17 16:54:56
1378
原创 git 批量 pull 脚本
步骤:1、切换到git目录;2、获取当前分支名;3、执行pull。4、脚本名:gitpull.bat cd C:\Android\Android Project\geek\RF-appfor /f "delims=" %%t in ('git symbolic-ref --short -q HEAD') do set str=%%tgit pull origin %...
2018-10-10 16:47:44
2204
原创 EditText 不会再执行selectAll
先让 EditText 失去焦点,再获取焦点。因为如果已经获取焦点,就不会再执行selectAll了。 EditTextandroid:selectAllOnFocus="true" binding.containerNumber.requestFocus();ViewUtils.requestFocus(binding.carrierNumber); pub...
2018-10-10 16:42:35
758
原创 依赖module ,但是project 不会复制module 到 project目录下
settings.gradle配置:'onshelf' 为module。'app' 为project。include ':app'include(':onshelf')project(':onshelf').projectDir=new File('../RF-onshelf/onshelf')// project(':onshelf').projectDir=new Fi...
2018-10-10 16:27:51
293
转载 IOUtils, FileUtils,FilenameUtils ,FileSystemUtils ,EndianUtils
This package defines utility classes for working with streams, readers, writers and files. The most commonly used classes are described here:IOUtils is the most frequently used class. It provides op
2017-03-01 15:02:33
386
转载 SharedPreferences
/** * Copyright (C) 2016 Hyphenate Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
2016-12-30 16:42:32
398
转载 DensityUtil
public class DensityUtil { public DensityUtil() { } public static int dip2px(Context var0, float var1) { float var2 = var0.getResources().getDisplayMetrics().density; retu
2016-12-30 16:20:40
196
原创 SurfaceView黑屏闪烁
在activity和fragment中加载SurfaceView,屏幕会闪一下(黑色)解决办法:在activity的oncreate方法中加入getWindow().setFormat(PixelFormat.TRANSLUCENT);需要导入包import android.graphics.PixelFormat;在fragment中使用在getWindow前加getActivity
2016-11-18 16:41:54
930
原创 返回键等效home键的效果
@Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setFlags(Intent.FLA
2016-10-20 15:44:15
275
原创 getTopActivity
public static String getTopActivity(Context context) { ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List runningTaskInfos = manager.getRunningT
2016-10-14 16:35:17
609
原创 scrollview smoothScrollTo不起作用的问题
LinearLayout ll = (LinearLayout) findViewById(R.id.ll); final ScrollView hsv = (ScrollView) findViewById(R.id.hsv); OnGlobalLayoutListener listener = new OnGlobalLayoutListener() {
2016-10-08 15:30:21
1256
原创 android设置透明activity
activity android:name=".activity.PushqQuitDialogActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
2016-09-29 11:20:40
219
原创 android service不被kill的方法
private ActivityManager activityManager; activityManager = (ActivityManager) mcontext.getSystemService(Context.ACTIVITY_SERVICE); IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
2016-07-22 15:54:39
233
libgdx引擎开发的游戏 demo gif图
2018-12-24
google android touch gesture
2016-07-28
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人