![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
android
weixin_35677874
这个作者很懒,什么都没留下…
展开
-
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 · 577 阅读 · 0 评论 -
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 · 409 阅读 · 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 · 433 阅读 · 0 评论 -
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 · 1297 阅读 · 0 评论 -
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 · 2157 阅读 · 0 评论 -
EditText 不会再执行selectAll
先让 EditText 失去焦点,再获取焦点。因为如果已经获取焦点,就不会再执行selectAll了。 EditTextandroid:selectAllOnFocus="true" binding.containerNumber.requestFocus();ViewUtils.requestFocus(binding.carrierNumber); pub...原创 2018-10-10 16:42:35 · 714 阅读 · 0 评论 -
依赖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 · 264 阅读 · 0 评论 -
国际化从服务器获取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 · 330 阅读 · 0 评论 -
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 · 355 阅读 · 0 评论 -
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 · 171 阅读 · 0 评论 -
SurfaceView黑屏闪烁
在activity和fragment中加载SurfaceView,屏幕会闪一下(黑色)解决办法:在activity的oncreate方法中加入getWindow().setFormat(PixelFormat.TRANSLUCENT);需要导入包import android.graphics.PixelFormat;在fragment中使用在getWindow前加getActivity原创 2016-11-18 16:41:54 · 813 阅读 · 0 评论 -
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 · 1199 阅读 · 0 评论 -
返回键等效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 · 252 阅读 · 0 评论 -
android设置透明activity
activity android:name=".activity.PushqQuitDialogActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Translucent.NoTitleBar" />原创 2016-09-29 11:20:40 · 172 阅读 · 0 评论 -
指定按钮获取焦点
如何让指定的按钮获取焦点:先让其它按钮不可获取焦点:setFocusable(false)。然后让指定的按钮获取焦点:binding.btnEmptyShelves.setFocusableInTouchMode(true);binding.btnEmptyShelves.requestFocus();binding.btnEmptyShelves.setFocu...原创 2019-03-08 11:29:52 · 1200 阅读 · 0 评论