我正在尝试使用Butter Knife来简化自定义BaseAdapter类的创建.我在这里的例子如下:http://jakewharton.github.io/butterknife/在"另一个用途是简化列表适配器内的视图持有者模式".部分.不幸的是,每次为列表中的每个项目创建ViewHolder时,我都会收到"无法注入视图"错误.
这是我的代码:
public class ButterknifeCustomBaseAdapter extends BaseAdapter{
@Override
public int getCount() {
return arrayListNames.size();
}
@Override
public Name getItem(int iPosition) {
return arrayListNames.get(iPosition);
}
@Override
public long getItemId(int iID) {
return 0;
}
LayoutInflater inflater;
ArrayList<Name> arrayListNames = new ArrayList<Name>();
static Context context;
Activity activity;
public ButterknifeCustomBaseAdapter(Context context, ArrayList<Name> names, Activity activity) {
arrayListNames = names;
this.context = context;
inflater = LayoutInflater.from(this.context);
}
static class ViewHolder implements View.OnClickListener {
@InjectView(R.id.textViewFullName) TextView textViewFullName;
@InjectView(R.id.imageButtonDeleteName) TextView imageButtonDeleteName; …
Run Code Online (Sandbox Code Playgroud) 我有一个具有以下插件结构的wepback.config.js文件:
/**************************************************
Plugins imported:
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
*********************************************************/
plugins: [
new HtmlWebpackPlugin({
inlineSource: '(main.bundle.js)',
template: './web/leafletReact.html',
inject: 'body'
}),
new webpack.optimize.UglifyJsPlugin({
// Eliminate comments
comments: false,
// Compression specific options
compress: {
// remove warnings
warnings: false,
// Drop console statements
drop_console: true
},
}),
new HtmlWebpackInlineSourcePlugin(),
new CopyWebpackPlugin([
{
from: path.join(__dirname, '/build/*.html'),
to: path.join(__dirname, '/assets/dist'),
toType: 'dir',
flatten: true
}
])
]
Run Code Online (Sandbox Code Playgroud)
即使CopyWebpackPlugin列在最后,它也要在HtmlWebpackInlineSourcePlugin完成之前运行。有没有一种方法可以强制CopyWebpackPlugin等待所有其他插件完成?
几个小时以来我一直在研究以下问题,但还没有找到解决问题的方法.我已经尝试了Stack Overflow中的以下修复(Android Studio更新到1.0会破坏Gradle插件v0.13.1之后的MultiDex和重复Zip条目),但它们都没有工作.
我在尝试构建程序时遇到以下错误:
Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: org/apache/commons/io/CopyUtils.class
Run Code Online (Sandbox Code Playgroud)
该错误似乎表明commons-io在构建过程中被包含两次
我正在使用Android Studio和Gradle来包含多个Robospice依赖项.这是我的Gradle构建文件的依赖项部分:
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile'com.google.api-client:google-api-client-android:1.19.0'
// You must install or update the Google Repository through the SDK manager to use this dependency.
// The Google Repository (separate from the corresponding library) can be found in the Extras category.
//compile 'com.google.android.gms:play-services:4.3.23'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.jakewharton:butterknife:${butterknifeVersion}"
compile 'com.sun.jersey:jersey-bundle:1.8'
compile 'com.google.code.gson:gson:2.3'
compile 'org.codehaus.jackson:jackson-core-asl:1.9.0' …
Run Code Online (Sandbox Code Playgroud) 我正在使用 tweenjs 和 Typescript 来更改 Three.js 立方体的 x 和 y 坐标。我创建了以下补间来更改“FallingItem”类项目的 x 位置。
this.movementArcData.horzTween = new TWEEN.Tween(this.movementArcData.pos.x)
.to(this.movementArcData.newPos.x, this.movementArcData.movementTime * 1000)
.onUpdate(this.updateXPos)
.onComplete(this.horzTweenComplete);
Run Code Online (Sandbox Code Playgroud)
其中“this.movementArcData”是一个包含以下内容的对象:
pos.x - 项目的原始位置
moveTime - 完成移动所需的时间,2000 毫秒
updateXPos - FallingItem 对象的成员函数,代码如下:
updateXPos(){ this.mesh.position.x = this.movementArcData.pos.x; console.log("更新 x:" + this.movementArcData.pos.x); }
horzTweenComplete - FallingItem 对象的成员函数,代码如下:
horzTweenComplete(){
this.movementArcData.horzTweenComplete = true;
}
Run Code Online (Sandbox Code Playgroud)
updateXPos 或 horzTweenComplete 回调都不会被触发。
我在渲染循环中调用 TWEEN.update ,如下所示:
TWEEN.update(dt);
Run Code Online (Sandbox Code Playgroud)
由于补间的 onComplete 事件从不触发,因此会不断调用 TWEEN.update。我错过了什么导致补间无法正常工作?
android ×2
annotations ×1
baseadapter ×1
butterknife ×1
gradle ×1
java ×1
javascript ×1
robospice ×1
tween.js ×1
typescript ×1
webpack ×1