由于内容的大小,我想以编程方式将@foreach(session('data_record') as $item)
{{$item->lat}},{{$item->lng}} <br>
@endforeach
项高度更改为RecyclerView
或match_parent
。如何更改子项的高度?
wrap_content
答案 0 :(得分:0)
您需要在RecyclerView中覆盖onBindViewHolder并在viewholder的容器上调用setLayoutParams。
示例:
@Override
public void onBindViewHolder(SimpleItemViewHolder holder, int position){
// do whatever here
// add your layout parameters here. Here I'm setting the width and height to match parent
TableRow.LayoutParams params = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); //(width,height)
holder.container.setLayoutParams(params);
}