Android 小问题 集锦

来源:互联网 发布:it工程师英文自我介绍 编辑:程序博客网 时间:2024/05/16 00:24

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

0 0
原创粉丝点击