Tencent/QMUI_Android · error · RuntimeException
More than one view in xml are marked by qmui_is_target = tru
Error message
More than one view in xml are marked by qmui_is_target = true.
What it means
QMUIPullLayout.onFinishInflate throws when more than one child view in the layout XML has qmui_is_target="true". The pull layout supports exactly one target view (the scrollable content), so duplicates are treated as an invalid layout.
Source
Thrown at qmui/src/main/java/com/qmuiteam/qmui/widget/pullLayout/QMUIPullLayout.java:120
TypedArray array = context.obtainStyledAttributes(attrs,
R.styleable.QMUIPullLayout, defStyleAttr, 0);
mEnabledEdges = array.getInt(R.styleable.QMUIPullLayout_qmui_pull_enable_edge, PUL_EDGE_ALL);
array.recycle();
mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
mScroller = new OverScroller(context, QUNITIC_INTERPOLATOR);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
boolean isTargetSet = false;
int edgesSet = 0;
for (int i = 0; i < getChildCount(); i++) {
View view = getChildAt(i);
LayoutParams lp = (LayoutParams) view.getLayoutParams();
if (lp.isTarget) {
if (isTargetSet) {
throw new RuntimeException(
"More than one view in xml are marked by qmui_is_target = true.");
}
isTargetSet = true;
setTargetView(view);
} else {
if ((edgesSet & lp.edge) != 0) {
String text = "";
if (lp.edge == PULL_EDGE_LEFT) {
text = "left";
} else if (lp.edge == PULL_EDGE_TOP) {
text = "top";
} else if (lp.edge == PULL_EDGE_RIGHT) {
text = "right";
} else if (lp.edge == PULL_EDGE_BOTTOM) {
text = "bottom";
}
throw new RuntimeException("More than one view in xml marked by qmui_layout_edge = " + text);
}View on GitHub (pinned to 026e7d4866)
Solutions
- Keep qmui_is_target="true" on exactly one direct child of QMUIPullLayout.
- Remove the attribute from included/merged layouts, or set it only on the include root.
- Move non-target content (e.g. action views) to children marked only with qmui_layout_edge.
Example fix
<!-- before -->
<com.qmuiteam.qmui.widget.pullLayout.QMUIPullLayout>
<View app:layout_qmui_is_target="true"/>
<View app:layout_qmui_is_target="true"/>
</...>
<!-- after: only one target -->
<com.qmuiteam.qmui.widget.pullLayout.QMUIPullLayout>
<View app:layout_qmui_is_target="true"/>
<View app:layout_qmui_layout_edge="top"/>
</...> Defensive patterns
Strategy: validation
Validate before calling
// pre-inflate XML audit
int targetCount = 0;
for (int i = 0; i < pullLayout.getChildCount(); i++) {
QMUIPullLayout.LayoutParams lp = (QMUIPullLayout.LayoutParams) pullLayout.getChildAt(i).getLayoutParams();
if (lp.isTarget) targetCount++;
}
// targetCount must be exactly 1 Try / catch
try {
setContentView(R.layout.pull_screen);
} catch (RuntimeException e) {
throw new IllegalStateException("check qmui_is_target: exactly one child allowed", e);
} Prevention
- Mark qmui_is_target on exactly one direct child per QMUIPullLayout.
- Never mark targets inside <include>/<merge> sources that get inflated into the pull layout.
- Lint/review XML diffs for duplicated attributes after copy-paste.
When it happens
Trigger: Declaring two or more children in the QMUIPullLayout XML with the attribute app:qmui_is_target="true"; also merging/inflating an included layout that also marks a target into the same pull layout.
Common situations: Copy-pasting a child block in XML and leaving the attribute on both; combining a manually declared target with an <include> whose root also sets qmui_is_target.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- More than one view in xml marked by qmui_layout_edge =
- Not support the type: %s
- topView must implement from IQMUIContinuousNestedTopView
- bottomView must implement from IQMUIContinuousNestedBottomVi
- delegateView must be a instance of View
AI-assisted analysis of Tencent/QMUI_Android@026e7d4866 (2026-09-06).
Data as JSON: /api/errors/b16f30bde9a3a6d4.
Report an issue: GitHub.