为什么BootStrap卡组件会拉伸容器尺寸?

问题描述

我的代码here

根据我的代码,我将两个单元格的高度都设置为50%(即CSS类面板), 为什么Card组件会将父单元格的高度拉伸到50%以上?

“卡片”组件在横向时可以正常工作,但是不幸的是,在纵向时无法使用。

添加了以下CSS来控制它,但是,所有这些都不起作用。

height:50%;
min-height:50%;
max-height: 50%;

又如何防止Card组件将父单元格的高度拉伸到50%以上?

解决方法

您可以选择为其父元素分配高度。

    String result = ReadJsonFile();
    Timber.tag("resultOfJSONGet").i(result);
    JSONObject obj = new JSONObject(result);

    private static String ReadJsonFile() {
    String jsonStr = null;
    try {
        FileInputStream stream = new FileInputStream(jsonFile);

        try {
            FileChannel fc = stream.getChannel();
            MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY,fc.size());

            jsonStr = Charset.defaultCharset().decode(bb).toString();
            } catch (Exception e) {
            e.printStackTrace();
            } finally {
            stream.close();
            }
           } catch (IOException e) {
              e.printStackTrace();
           }

              return jsonStr;
         }

根据需要在媒体查询中分配