移动混合开发之android文件管理-->flexbox,webFont。

博客介绍前端开发相关内容,包括使用felxbox实现操作栏居中,给出felx相关参考网址;还提到用webFont添加图标,并提供下载地址。此外,指出index.js暂无变化,可参考上一篇随笔,还给出了转载来源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

增加操作栏,使用felxbox居中,felx相关参考网址:http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html

使用webFont添加图标,webFont下载地址为http://fontello.com/

index.html:

<!DOCTYPE html>
<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 -->
<html>
<head>
    <!--
     Customize this policy to fit your own app's needs. For more guidance, see:
     https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
     Some notes:
     * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
     * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
     * Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
     * Enable inline JS: add 'unsafe-inline' to default-src
     -->
    <meta http-equiv="Content-Security-Policy"
          content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta charset="utf-8">
    <meta name="viewport"
          content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
    <!--引入webFont,fontello.css里面已经定义好font-family,只是需要设置类名,单独写css控制位置即可-->
    <link rel="stylesheet" type="text/css" href="./css/css/fontello.css">
    <link rel="stylesheet" type="text/css" href="css/index.css"><br>
    <!----引入jQuery----!>
    <!--引入滑动第三方库,让列表滑动-->
    <script type="text/javascript" src="js/jquery-2.2.4.min.js"></script>
    <script type="text/javascript" src="js/iscroll-lite.js"></script>
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
    <title>Hello World</title>
</head>
<body>
<div id="log"></div>
<div class="head">
    极客浏览器
</div>
<!--自定义布局,没有使用第三方框架-->
<div class="content">
    <div class="nav">
        <div id="current-dir"></div>
        <div id="upper">上一级</div>
    </div>
    <div class="list" id="file-list">
        <ul >
            <li class="t">
                <div class="file-icon"></div>
                <div class="file-name">This is file name1</div>
            </li>
        </ul>
    </div>
    <div class="opeator">
        <!--写好类名,类名可查看fontello下载的demo-->
        <a class="icon-trash-empty">新建文件夹</a>
        <a class="icon-server">复制</a>
        <a class="icon-html5">删除</a>
    </div>
</div>
</body>
</html>

  

index.css

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
* {
    -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
}

.head{
    position:absolute;
    left:0;
    right:0;
    top:0;
    height:2rem;
    line-height: 2rem;
    background-color:orange;
    padding-left:.3rem;
    color: white;
    text-align: center;
}

.content{
    position:absolute;
    top:2rem;
    bottom:0;
    left:0;
    right:0;
    overflow: hidden;
}
.content .nav{
    position: absolute;
    top: 0;
    height: 1.5rem;
    left: 0;
    right: 0;
    background: #efefef;
}

.content .list{
    position: absolute;
    top: 1.5rem;
    left: 0;
    right: 0;
    bottom: 3rem;
    background: #adadad;
    overflow: hidden;
}

.opeator{
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3rem;
    /*容器使用 display:felx属性*/
    display:flex;
    display: -webkit-flex; /*  */
}

.opeator a{
    /*使用felx:1让内容平均分布*/
    flex:1;
    -webkit-box-flex: 1;
    /*把webFont当作字体处理,字体居中*/
    text-align: center;
}
.content ul{
    list-style: none;
    padding: 0;
    margin: 0;
}

.content ul li{
    position: relative;
    height: 4rem;
    line-height: 2rem;
    padding-left: .5rem ;
    border-bottom: 1px solid gray;
    background: white;
}
.content ul li.touchInside{
    background: #efefef;
}
.content ul li .file-icon{
    position: absolute;
    background: url("../img/file.png") no-repeat center;
    background-size: 1.2rem 1.2rem;
    width: 1.2rem;
    height: 1.2rem;
    left: 1rem;
    top:.3rem;
}
.content ul li .file-name{
    position: absolute;
    line-height: 2rem;
    left: 3.2rem;
}

.t{
    display: none;
}
#upper{
	position: absolute;
	right: 15px;
	top: 5px;
	color: blue;
}

#log{
    width: 200px;
    height: 30px;
    color: red;
    float: right;
}

/*重新定义图标位置*/
.trash:before{
    display: block;
    padding-top: 10px;
    /*这个会使字体不居中,直接指定fontSize就好*/
    font-size: 1.2rem;
}

.icon-server:before{
    display: block;
    padding-top: 10px;
    /*这个会使字体不居中,直接指定fontSize就好*/
    font-size: 1.2rem;
}

.icon-html5:before{
    display: block;
    padding-top: 10px;
    /*这个会使字体不居中,直接指定fontSize就好*/
    font-size: 1.2rem;
}

  

  index.js 暂无变化,参考上一篇随笔

 

转载于:https://www.cnblogs.com/yqlog/p/5615382.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值