尝试在我的项目中使用最新的appcompat-v7支持库时,出现以下错误:
/Users/greg/dev/mobile/android_project/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/res/values-v11/values.xml
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
android gradle xamarin.android android-support-library android-5.0-lollipop
由于下载最新的SDK并安装Android Studio,我的项目无法构建.我收到以下消息:
Error:Gradle: Execution failed for task ':SampleProject:processProdDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1
Run Code Online (Sandbox Code Playgroud) android android-studio android-gradle-plugin android-5.0-lollipop
更新(2014年10月11日):Genymotion发布了2.3.1修复了这个问题.https://cloud.genymotion.com/page/changelog/#231
更新(2014年10月21日):Genymotion回复了我的支持电子邮件,并指出@plackemacher推荐的解决方案是目前建议的解决方案.他们意识到了这个问题.
自从升级到Lollipop后,我在使用Genymotion模拟器时遇到了adb问题.设备未显示在Android Studio中,我在尝试运行时也遇到以下错误adb devices:
$ adb devices
adb server is out of date. killing...
cannot bind 'tcp:5037'
ADB server didn't ACK
* failed to start daemon *
error:
Run Code Online (Sandbox Code Playgroud)
我不确定是不是因为Lollipop升级或巧合.
编辑/更新:
根据Chris Satton的评论,我调查了多个adb进程是否正在运行(ps aux | grep adb),看起来它是一个Genymotion冲突(?).它看起来包含自己的adb版本.
格雷格72550 0.0 0.0 611164 1508 ?? S 4:14 PM
0:00.02 /Applications/Genymotion.app/Contents/MacOS/player.app/Contents/MacOS/tools/adb -s 192.168.56.102:5555 shell格雷格72523 0.0 0.0 635956 2296 ?? S 4:14 PM 0:00.02 adb -P 5037 fork-server服务器
我正在尝试使用Jake Wharton的ViewPagerIndicator库,但是我无法在Android Studio中使用我的Gradle项目.
我将其添加为依赖项,如下所示:
dependencies {
// ... other ommitted
compile 'com.viewpagerindicator:library:2.4.1'
compile 'com.android.support:support-v4:19.0.1'
compile 'com.nineoldandroids:library:2.4.0'
// ...
}
Run Code Online (Sandbox Code Playgroud)
但该项目似乎无法识别库中的任何组件.我想知道不同的support-v4版本是否存在依赖性问题,或者是九折机器人的某些东西......?
我不小心创建了一个没有.xml扩展名的文件.在将该文件与其他类型相关联后,我立即点击了另一个对话框......?重命名文件以包含.xml后,文件仍然没有语法突出显示.我试过关闭Android Studio,删除文件并重新创建等等.它仍然显示为常规文件.如果我使用不同的.xml文件创建一个文件,它可以很好地关联.
有任何想法吗?
是否可以创建仅在Android Studio的布局设计过程中可见的占位符文本?
例如,假设我在线性布局中有2个TextView,它们将被动态填充.在设计阶段,我使用占位符文本来确保填充和正确.我经常忘记删除占位符文本,因此在加载新数据期间,旧数据将暂时显示...看起来很俗气.
如果有一个类似于android:placeholderText="This is placeholder text"仅在预览中显示的字段,那将会很酷.有没有我碰巧错过的东西?
有没有一种从命令行在SourceTree中打开git存储库的快捷方法?
我从终端做了很多git工作,但有时候没有替代好的历史视图/差异.希望能够在不使用书签的情况下打开.
假设我有一个类似于以下的菜单(options_menu.xml):
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item android:id="@+id/action_login"
android:title="Login"
app:showAsAction="always"/>
</menu>
Run Code Online (Sandbox Code Playgroud)
我膨胀到新的工具栏项目
mToolbar.inflateMenu(R.menu.options_home);
Run Code Online (Sandbox Code Playgroud)
这导致类似的东西

有没有办法在不使用图像,更改工具栏文本颜色的其余部分或通过向工具栏添加自定义视图的情况下更改此文本颜色?寻找minSdk 15(appcompat)的答案.
更新:
我的相关风格:
<style name="AppTheme" parent="AppTheme.Base">
<item name="actionMenuTextColor">@color/ww_red</item>
</style>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/red</item>
<item name="colorAccent">@color/theme_accent</item>
<item name="android:textColor">@color/text_dark</item>
<item name="android:colorEdgeEffect">@color/gray</item>
</style>
Run Code Online (Sandbox Code Playgroud) 我在我的布局中包含了一个v7工具栏.
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
/>
Run Code Online (Sandbox Code Playgroud)
我正在使用以下内容向其中填充菜单:
mToolbar.inflateMenu(R.menu.options_add_contact);
Run Code Online (Sandbox Code Playgroud)
现在我怎么知道删除/重置它?我在黑暗中试了几次:
mToolbar.inflateMenu(0)moolbar.setMenu(null, null)toolbar.setMenu(null, null)我在自定义视图的构造函数中调用以下内容:
private void style(Resources.Theme theme, AttributeSet attrs) {
TypedArray a = theme.obtainStyledAttributes(
attrs,
R.styleable.StackedTextView,
0, 0);
try {
DebugTool.assertTrue(holdr != null, "View holder has not been properly intialized.");
String line1 = a.getString(R.styleable.StackedTextView_line1);
setLine1(line1);
String line2 = a.getString(R.styleable.StackedTextView_line2);
setLine2(line2);
line1Size = a.getDimension(R.styleable.StackedTextView_line1_textSize, 20);
line2Size = a.getDimension(R.styleable.StackedTextView_line2_textSize, 20);
if (line1Size > 0) {
holdr.textLine1.setTextSize(line1Size);
}
if (line2Size > 0) {
holdr.textLine2.setTextSize(line2Size);
}
} finally {
a.recycle();
}
}
Run Code Online (Sandbox Code Playgroud)
它应该为2个文本字段设置文本和文本大小.
除了文本内容的字符串格式之外,我在attr.xml中还有以下内容(工作正常).
<attr name="line1_textSize" format="dimension" />
<attr name="line2_textSize" format="dimension" />
Run Code Online (Sandbox Code Playgroud)
当我使用此视图并通过xml使用维度设置文本大小时,
<com.me.app.view.component.StackedTextView
android:id="@+id/overview_total_reviews"
app:line1="40" …Run Code Online (Sandbox Code Playgroud) android ×8
gradle ×2
adb ×1
android-menu ×1
command-line ×1
genymotion ×1
git ×1
placeholder ×1
xml ×1