Skip to content

能否增加通用性的布局查找功能 #22

Description

@DaoJianShenYu

首先非常感谢你开发这个炫酷的插件,其次这种直接生成代码而不是注解的方式和我的想法不谋而合,我很赞同,不过我技术暂时还不够,做不了这个.
实际开发中会对Activity或Fragment进行抽取,初始化view往往不在Activity中进行操作,而在ViewHolder或者其它什么地方,用View.inflate()的方式充出一个view,这样子就没法用这个插件的功能了.
如果没有oncreat方法,能否直接在类中生成initView()方法,最好能指定view.findViewById(),当然前面的view名能自定义就好了.
示例如下:

public class CategoryInfoHolder extends BaseHolder<Object> {
    private ImageView ivImage1, ivImage2, ivImage3;
    private TextView tvName1, tvName2, tvName3;
    @Override
    public View initHolderView() {
        View view = View.inflate(GooglePlayApplication.context, R.layout.adapter_category_info, null);
        ivImage1 = (ImageView) view.findViewById(R.id.iv_image1);
        ivImage2 = (ImageView) view.findViewById(R.id.iv_image2);
        ivImage3 = (ImageView) view.findViewById(R.id.iv_image3);
        tvName1 = (TextView) view.findViewById(R.id.tv_name1);
        tvName2 = (TextView) view.findViewById(R.id.tv_name2);
        tvName3 = (TextView) view.findViewById(R.id.tv_name3);
        return view;
    }

其实我觉得太麻烦的话,直接将代码直接生成在类中即可,具体手动移动下就行
回头研究下你的插件功能,可以一起着重开发下,哈

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions