css - UI5响应式布局控件(创建响应式CustomListItem)

标签 css responsive-design sapui5

我在 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;
                }

enter image description here

因此,如果浏览器窗口是全屏,它工作正常,但是:在屏幕截图上,您可以看到上面带有 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/

相关文章:

javascript - jQuery 在 Action 发生后加载脚本

java - 当使用 'display: block' 设置样式时,GWT CheckBox 不会对 onMouseOver/onMouseOut 事件使用react

css - 为什么只有我的大型媒体查询有效?

javascript - SAPUI5 日期选择器只读

javascript - SAPUI5中有 anchor 吗

javascript - 添加base64图像后,水平滚动仅出现在iphone中

jquery - 用 jquery 在 </span> 之后添加 <br/>

javascript - 保持谷歌地图标记在所有视口(viewport)中居中

javascript - matchMedia.js 是否需要 respond.js 才能在旧版 IE 浏览器中工作

使用路由器时,Shell 在 SAPUI5 中不显示主(第一) View