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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值