binIoter / GuideView

东半球最好用的新手引导库,能够快速为任何一个View创建一个遮罩层,支持单个页面,多个引导串联展示,支持为高亮区域设置不同的图形,支持引导动画,方便扩展,良好支持fragment
3.96k stars 651 forks source link

在根布局中使用 match_parent 是无效 #73

Open zouchuqu opened 4 years ago

zouchuqu commented 4 years ago

在根布局中使用 match_parent 无效,使用比重参数(android:layout_weight)也是无效的,导致部分UI很难做适配。

<TextView
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1" />
QianHong commented 3 years ago

同问 兄弟解决了吗

QianHong commented 3 years ago

public View getView(LayoutInflater inflater) { ConstraintLayout cl = (ConstraintLayout) inflater.inflate(R.layout.bookdetail_detail_item_review_guide_view, null, false); ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT); layoutParams.width = ScreenUtils.getScreenWidth(); cl.setLayoutParams(layoutParams); LinearLayout ll = new LinearLayout(inflater.getContext()); LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); ll.setOrientation(LinearLayout.VERTICAL); param.width = ScreenUtils.getScreenWidth(); ll.setLayoutParams(param); ll.addView(cl); return ll; }

这样好像有点用处