我在 XML View 中构建了一个 CustomListItems 列表:
<!-- List with CustomListItem (seperate Icon for event) -->
<List class="cTL" id="test-list2" type="Active" headerText="CustomListItems with Icon Control" items="{path : '/products'}">
<CustomListItem title="boom" counter="3" class="cTL-item" tabindex="1">
<content>
<core:Icon tabindex="2" decorative="false"
color="{
path: 'price',
formatter:'.setPrioColor'
}"
src="sap-icon://add"></core:Icon>
<layout:VerticalLayout class="cTL-text">
<layout:content>
<Label color="#333333" class="cTL-text-title" text="Orange"></Label>
<Text maxLines="1" wrapping="true" class="cTL-text-desc" text="Spain this is a long long long text lalalala onetwothree einzweidreivier Spain this is a long long long text lalalala onetwothree einzweidreivier"></Text>
</layout:content>
</layout:VerticalLayout>
</content>
</CustomListItem>
</List>
我添加了一些自定义的 css,所以它看起来就像一个 StandardListItem:
.cTL .cTL-item.sapMLIB {
padding: 0 1rem 0 1rem;
}
.cTL .sapUiIcon {
font-size: 1.375rem;
vertical-align: 80%;
}
.cTL .cTL-text {
margin: 1rem 0.5rem 0.5rem 1rem;
}
.cTL .cTL-text .cTL-text-title.sapMLabel {
font-size: 1rem;
color: #333333;
}
.cTL .cTL-text-desc {
color: #666666;
}
因此,如果浏览器窗口是全屏,它工作正常,但是:在屏幕截图上,您可以看到上面带有 StandardlistItems 的列表和下面的 CustomListItems。 .. 他们没有回应!您会推荐哪个布局元素使其表现得像 Standardlistitem(缩短文本和响应式对齐方式)?
最佳答案
我会将内容包装在 HBox
中,图标和附加布局(我更喜欢 VBox
而不是 VerticalLayout
) 在他们自己的居中 VBox
:
(删除了除重要属性之外的所有属性):
<List>
<CustomListItem>
<content>
<HBox justifyContent="Start" fitContainer="true">
<VBox justifyContent="Center">
<core:Icon />
</VBox>
<VBox justifyContent="Center">
<Label />
<Text />
</VBox>
</HBox>
</content>
</CustomListItem>
</List>
关于css - UI5响应式布局控件(创建响应式CustomListItem),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28965663/