Android 小问题 集锦

Posted 粪乧

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android 小问题 集锦相关的知识,希望对你有一定的参考价值。

1.如何禁用DrawerLayout阴影

mDrawerLayout.setScrimColor(Color.TRANSPARENT);


setDrawerShadow(Drawable shadowDrawable, int gravity)
setDrawerShadow(int resId, int gravity)

原文地址
2.

android Studio: Could not find com.android.tools.build:gradle:2.0.0-alpha2

In the main build.gradle file, add jcenter() as main repo, just like that :

buildscript 
    repositories 
        jcenter()
    
    dependencies 
        classpath 'com.android.tools.build:gradle:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    


allprojects 
    repositories 
        jcenter()
    

原地址

3.ndk开发错误

Error:(12, 0) Error: NDK integration is deprecated in the current plugin.  Consider trying the new experimental plugin.  For details, see http://tools.android.com/tech-docs/new-build-system/gradle-experimental.  Set "android.useDeprecatedNdk=true" in gradle.properties to continue using the current NDK integration.
<a href="openFile:/Users/xyb/Desktop/Camera/tutorial-2-mixedprocessing/openCVTutorial2MixedProcessing/build.gradle">Open File</a>

我们可以在跟目录下创建一个gradle.properties文件
添加一个android.useDeprecatedNdk=true;

4.mac 下显示隐藏文件

如果你实在想尝试命令操作,可参考:​
显示:defaults write com.apple.finder AppleShowAllFiles -bool true
隐藏:defaults write com.apple.finder AppleShowAllFiles -bool false

5.mac 下Android Studio 查看SHA1 与MD5

终端(Terminal)输入:

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

6.ListView的Item被点击和其中的Button被点击同时生效:

Android开发中在ListView中经常有Button或ImageButton等需要被点击的控件,如果不加一些特殊的限制,有可能ListView的Item的点击事件或Button的点击事件,其中一个不能响应。我遇到的情况是ListView的Item不能响应点击事件。

解决的办法,在ListView的Item的xml文件中添加如下属性:
1)整个xml文件的根元素如LinearLayout中添加属性android:descendantFocusability="blocksDescendants"
2)被点击的控件如ImageButton中添加属性android:focusable="false"和android:clickable="true"
                         完美解决!

7.Android Studio 代码显示行数:

Show line numbers

8.Android Studio 更新 Android 6.0 之后无法找到 org.apache.http 包的问题


原文链接:https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html

以上是关于Android 小问题 集锦的主要内容,如果未能解决你的问题,请参考以下文章

微信小程序 | 49,小程序入门集锦系列文章20篇

mysql小问题集锦

Android常见问题集锦

GitHub:小目标检测最全资料集锦

[Android问答] 开发环境问题集锦

启动Android模拟器问题集锦