小编gma*_*ate的帖子

XML属性从合并布局到RelativeLayout通过膨胀

根据这个CommonsWare示例,我设法将我的RelativeLayout子类与我在xml布局中描述的具有合并根的布局合并.我唯一担心的是我无法在xml中描述我的RelativeLayout参数.

我的xml布局:

<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:my="http://schemas.android.com/apk/res/hu.someproject"
  android:layout_width="36dp"
  android:layout_height="wrap_content"
  android:layout_marginLeft="3dp"
  android:layout_marginRight="3dp"
  android:width="36dp" >

 <RelativeLayout
    android:id="@+id/upper_container"
    style="?pretty_style"
    android:layout_alignLeft="@+id/image_title"
    android:layout_alignParentTop="true"
    android:layout_alignRight="@+id/image_title"
    android:layout_centerHorizontal="true" >

    <View
        android:id="@+id/upper_indicator"
        android:layout_width="fill_parent"
        android:layout_height="5dp"
        android:layout_alignParentTop="true"
        android:background="@color/mycolor" />

    <TextView
        android:id="@+id/text_degree"
        style="?pretty_style"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="23°" />
</RelativeLayout>

<hu.MyView
    android:id="@+id/image_title"
    style="?my_image_title"
    android:layout_below="@+id/upper_container"
    android:layout_centerHorizontal="true"
    my:myColor="#2f8741"/>
Run Code Online (Sandbox Code Playgroud)

我认为问题是合并标签的子节点发生合并,而不是合并本身.任何想法如何在合并中获取我的参数以影响我的RelativeLayout?

我的RelativeLayout子类,没有包声明和导入:

public class MyRelativeLayoutSubclass extends RelativeLayout {

    public MyRelativeLayoutSubclass(Context context) {
        super(context);

        initTile(null);
    }

    public MyRelativeLayoutSubclass(Context context, AttributeSet attrs) {
        super(context, attrs);

        initTile(attrs);
    }

    public MyRelativeLayoutSubclass(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle); …
Run Code Online (Sandbox Code Playgroud)

xml layout user-interface android commonsware

9
推荐指数
1
解决办法
1万
查看次数

在ListView中为列表项设置动画

我尝试在ListView中为新项目制作动画.我有稳定的id-s,所以我确切知道要动画的元素.问题来自ListView的循环机制.当我知道我有一个最近插入的元素时,我在视图上调用startAnimation.但随后,视图得到了回收,充满了不同的数据.它会在UI上为错误的行设置动画.在某些时候,视图持有正确的数据,但随后被回收.我通过logcat证实了这一点.有什么方法可以解决这个问题吗?

编辑:

public ExpensCursorAdapter(Context context, Cursor c, boolean autoRequery,
        CopyOnWriteArraySet<String> fadeAnimateTags) {
    super(context, c, autoRequery);
    this.mFadeAnimTags = fadeAnimateTags;
}

@Override
public boolean hasStableIds() {
    return true;
}

@Override
public void bindView(View view, Context context, Cursor cursor) {
    setup(view, context, cursor);
}

private void setup(View view, Context context, Cursor cursor) {
    final String id = cursor.getString(4);
    if (LOCAL_LOGV) Log.v(TAG, String.format("Create item for %s. Received view: %s", id, view.toString()));
    view.setTag(id);
    final TextView dateText = (TextView) view.findViewById(R.id.date);
    final TextView timeText = (TextView) view.findViewById(R.id.time); …
Run Code Online (Sandbox Code Playgroud)

android listview adapter

8
推荐指数
3
解决办法
1万
查看次数

使用调试密钥测试inapp购买

我正在尝试测试inapp购买,但每当我使用eclipse进行部署(使用调试密钥签名)时,它会说: "此版本的应用程序未配置为市场结算.请查看帮助中心以获取更多信息." 当我导出apk的发布版本(用我的私钥签名)时,没关系.我的问题是:我必须导出apk,将其上传到设备,运行测试?这浪费了很多时间,我也无法进行测试.我错过了什么吗?

android in-app-purchase apk google-play

6
推荐指数
2
解决办法
4514
查看次数

理解Webpack输出

我尝试在1200模块(95%供应商)的观察模式下优化我们的6s构建时间.我试着了解发生了什么,所以我可以让它更快.

我不明白的事情:

  • [emit]意味着给定的块是建立的吗?
  • 如何验证给定的块是否重建?
  • 我怎么能看到chunkHash?(我想确保webpack与md5的方式相同)
  • 我可以寻找什么样的优化?

事实:

  • 如果应用程序代码更改,则供应商软件包不会以监视模式写入磁盘,我通过修改日期进行验证并删除它.触发重建时未创建该文件.此外,供应商代码的md5哈希不会更改.
    • 大多数时间花在模块构建上,模块计数器从0-> 1200运行.

webpack配置如下:

var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var WatchIgnorePlugin = require('watch-ignore-webpack-plugin')
var CopyWebpackPlugin = require('copy-webpack-plugin');
var path = require('path');
var webpack = require('webpack');

function isExternal(module) {
    var userRequest = module.userRequest;

    if (typeof userRequest !== 'string') {
          return false;
        }

    return userRequest.indexOf('bower_components') >= 0 ||
             userRequest.indexOf('node_modules') >= 0 ||
             userRequest.indexOf('libraries') >= 0;
}

module.exports = {
  context: __dirname + "/src",
  cache: true,
  cacheDirectory: '.cache',
  entry: {
      index: ["babel-polyfill", "./index"], …
Run Code Online (Sandbox Code Playgroud)

javascript webpack webpack-dev-server

6
推荐指数
1
解决办法
994
查看次数

Bootstrap复选框水平对齐错误

我使用了Bootstrap文档中的basiexample:http://getbootstrap.com/css/#forms-example

问题是复选框未与其余元素对齐.我试图将display属性设置为inline,但这没有帮助.

知道为什么吗? https://jsfiddle.net/6ua8xmce/

html css twitter-bootstrap

1
推荐指数
1
解决办法
1882
查看次数