Framework7 does not display the magnifier icon in the search bar of the Android device.

Source: Internet
Author: User
Tags min

1, problem description

Recently, using FRAMEWORK7 to develop Cross-platform H5 applications. When using the Search bar (Searchbar), it is normal to display in the IOS system.

But under the Android system, the magnifying glass icon in front of the search box is gone.

2, page code


<! DOCTYPE html>
<!--meta tag settings-->
<meta charset= "Utf-8" >
<meta name= "viewport" content= "Width=device-width, initial-scale=1,
Maximum-scale=1, minimum-scale=1, User-scalable=no, Minimal-ui ">
<meta name= "apple-mobile-web-app-capable" content= "yes" >
<meta name= "Apple-mobile-web-app-status-bar-style" content= "Black" >
<!--app Title-->
<title>hangge.com</title>
<!--using iOS CSS theme styles-->
<link rel= "stylesheet" href= "Css/framework7.ios.min.css" >
<!--IOS related color style-->
<link rel= "stylesheet" href= "Css/framework7.ios.colors.min.css" >
<!--custom Style-->
<link rel= "stylesheet" href= "Css/my-app.css" >
<body>
<!--Status Bar overlay for full screen mode (PHONEGAP)-->
<div class= "Statusbar-overlay" ></div>
<!--all views View-->
<div class= "views" >
<!--main view (Requires a "view-main" style)-->
<div class= "View View-main" >
<!--top navigation bar-->
<div class= "NavBar" >
<div class= "Navbar-inner" >
<!--header element (to add sliding style to the title text for the page to toggle)-->
<div class= "Center Sliding" >hangge.com</div>
</div>
</div>
<!--page container (pages container) as we use NavBar and toolbar in a fixed position,
So add extra styles here (Navbar-through and Toolbar-through)-->
<div class= "pages Navbar-through Toolbar-through" >
<!--homepage, "data-page" set the page name-->
<div data-page= "index" class= "page" >

<!--search bar (automatically initialized using the Searchbar-init style)-->
<form class= "Searchbar searchbar-init"
Data-search-list= ". List-block-search" data-search-in= ". Item-title"
Data-found= ". Searchbar-found" data-not-found= ". Searchbar-not-found" >
<div class= "Searchbar-input" >
<input type= "Search" placeholder= "Searching ..." >
<a href= "#" class= "Searchbar-clear" ></a>
</div>
<a href= "#" class= "Searchbar-cancel" > Cancel </a>
</form>

<div class= "Searchbar-overlay" ></div>

<div class= "Page-content" >
<div class= "Content-block searchbar-not-found" >
No query Results!
</div>

<div class= "List-block list-block-search searchbar-found" >
<ul>
... Query Results list ...
</ul>
</div>
</div>

</div>
</div>

</div>
</div>
Js--> of <!--FRAMEWORK7 Framework
<script type= "Text/javascript" src= "Js/framework7.min.js" ></script>
<!--JS--> for your application
<script type= "Text/javascript" src= "Js/my-app.js" ></script>
</body>

3. Problem Solving method

Because I am using the IOS skin style (framework7.ios.min.css), this definition of. Searchbar input[type= "Search" background-image is not shown on Android.
We can extract the related styles from the meterial skin style (FRAMEWORK7.MATERIAL.CSS) to override the default style.
For example, the custom CSS file used by this sample page is My-app.css, which adds the following style:


/** Search bar input box icon style overlay **/
. Searchbar input[type= "Search"] {
Background-image:url ("Data:image/svg+xml;charset=utf-8,%3csvg%20fill%3d '%23939398 '%20height%3D '%20viewBox%") 3D ' 0%200%2024%2024 '%20width%3d '%20xmlns%3d ' http%3a%2f%2fwww.w3.org%2f2000%2fsvg '%3e%3cpath%20d%3d ' M15.5% 2014h-.79l-.28-.27c15.41%2012.59%2016%2011.11%2016%209.5%2016%205.91%2013.09%203%209.5%203s3%205.91%203%209.5% 205.91%2016%209.5%2016c1.61%200%203.09-.59%204.23-1.57l.27.28v.79l5%204.99l20.49%2019l-4.99-5zm-6%200c7.01% 2014%205%2011.99%205%209.5s7.01%205%209.5%205%2014%207.01%2014%209.5%2011.99%2014%209.5%2014z '%2F%3E%3Cpath% 20d%3d ' m0%200h24v24h0z '%20fill%3d ' none '%2f%3e%3c%2fsvg%3e ');
-WEBKIT-BACKGROUND-SIZE:17PX 17px;
BACKGROUND-SIZE:17PX 17px;
}
(Note: In Background-image, I change the icon color to 939398, the same light gray as the hint text.) The original meterial skin definition is FFFFFF white)

4, Test run

Once again using the Android phone test, you can find that the magnifying glass icon appears normally.


Of course, using the IOS phone is no problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.