bmelnychuk / AndroidTreeView

AndroidTreeView. TreeView implementation for android
Apache License 2.0
3k stars 620 forks source link

Set Tree node to accept full width #139

Open prasad456 opened 6 years ago

prasad456 commented 6 years ago

I used Custom View for the node it applies as wrap Content I used the views as MAtch Parent

ehsanhvd commented 6 years ago
public static class MyHolder extends TreeNode.BaseNodeViewHolder<Category> {

        public MyHolder(Context context) {
            super(context);
        }

        @Override
        public View createNodeView(final TreeNode node, Category value) {
            final LayoutInflater inflater = LayoutInflater.from(context);
            final View view = inflater.inflate(R.layout.row_category_simple, null, false);
           ViewGroup.LayoutParams rootParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
            view.setLayoutParams(rootParams);  ///////*********set layout params to your view

            return view;
        }
    }
testica commented 5 years ago

@ehsanhvd Nice workaround 👍