使用Bootstrap CSS我想显示正确的移动视图

时间:2017-05-15 06:40:31

标签: javascript jquery html css twitter-bootstrap

我希望我的网站具有移动响应能力,并希望移动视图能够进行此类更改。我想提一下,添加cd-xs-12不会做任何更改,甚至cd-sm-12也无法获得我想要的内容。

enter image description here

这是我现有的代码



.mobile-select {height:50px;padding-top:15px;padding-left:60px;padding-right:20px}

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="row breadcrumb bg-white border-bottom paddl30">
  <div class="col-md-6">
    <ul>
      <li><a href="">Devices</a></li>
      <li> &gt; </li>
      <li>Screen Analytics</li>
    </ul>
  </div>
</div>
<div class="row mobile-select border-bottom">
  <div class="col-md-6">
    <ul class="device-menu bg-white">
      <li class="selected">
        <a href="javascript:void(0)" id="mobileAppScreens">Mobile</a>
        <span class="sub-menu-menu"> 
									<i class="fa fa-chevron-right" aria-hidden="true"></i>
									<a href="javascript:void(0)" ng-click="" id="iosMobileAppScreens" class="checked"> <i class="fa fa-apple" aria-hidden="true" ></i> ios</a>

									<a href="javascript:void(0)" ng-click="" id="androidMobileAppScreens"><i class="fa fa-android" aria-hidden="true"></i> Android</a>
								</span>
        <span class="grey-pipe">|</span>
      </li>
      <li>
        <a href="javascript:void(0)" id="tabletAppScreens">Tablet</a>
        <span class="sub-menu-menu hide"> 
									<i class="fa fa-chevron-right" aria-hidden="true"></i>
									<a href="javascript:void(0)" ng-click="" id="iostabletAppScreens"><i class="fa fa-apple" aria-hidden="true"></i> ios</a>

								<a href="javascript:void(0)" ng-click=""  id="androidtabletAppScreens"> <i class="fa fa-android" aria-hidden="true"></i> Android</a>
								</span>
      </li>
      <li class="hidden">
        <input type="text" id="selMenu" value="iosMobileAppScreens">
        <input type="text" id="sDate">
        <input type="text" id="eDate">
      </li>
    </ul>

  </div>
  <div class="col-md-6">
    <div id="dateRangescreenAnalytics" class="pull-right">
      <i class="glyphicon glyphicon-calendar txt-green fa fa-calendar"></i>
      <span></span><b class="caret"></b>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;

解决方案 - 在需要的地方添加<br class="visible-xs">

3 个答案:

答案 0 :(得分:0)

只需添加clearfixes,man。像这样:

<div class=clearfix></div>

在样式中它应该是这样的:

.clearfix {
clear: both;
}

答案 1 :(得分:0)

在头部标签内,放置这些线条。

public static int itemsCount = 10; //i need pagination of 10 records, so here i passed 10, you may increase this no. here as your requirement. ArrayList<User_pojo> allDataList, paginationList; Adapter_UserList adapter; ListView listViewUser; View footerView; LayoutInflater layoutInflater; int lastItem,preLast; Context context; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); context = this; listViewUser = (ListView) findViewById(R.id.listViewUser); allDataList = new ArrayList<>(); paginationList = new ArrayList<>(); layoutInflater = LayoutInflater.from(context); footerView = layoutInflater.inflate(R.layout.load_more_view, null); listViewUser.addFooterView(footerView); Call_api(); listViewUser.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { lastItem = (firstVisibleItem + visibleItemCount); if (lastItem == totalItemCount) { if (preLast != lastItem) { //to avoid multiple calls for last item preLast = lastItem; footerView.findViewById(R.id.progress_bar).setVisibility(View.VISIBLE); footerView.postDelayed(new Runnable() { @Override public void run() { itemsCount += 10; LoadMoreList(); listViewUser.setSelection(lastItem - 1); //to display more loaded records @ current displayed position. } }, 1500); } } } }); } @Override public void onStart() { super.onStart(); LoadMoreList(); } public interface AppService{ @FormUrlEncoded @POST("getUserList") Call<User_pojo> getUserList(@FieldMap(encoded = true) Map<String, String> map); } void Call_api() { Retrofit retrofit = new Retrofit.Builder() .baseUrl("http://your_api_url_here.com/") .addConverterFactory(GsonConverterFactory.create()) .build(); Call<User_pojo> call = retrofit.create(AppService.class).getUserList(getUserMap()); call.enqueue(new Callback<User_pojo>() { @Override public void onResponse(Call<User_pojo> call, Response<User_pojo> response) { Log.e("Response", new Gson().toJson(response.body())); if (response.body().getResponse().equalsIgnoreCase("true")) { allDataList = response.body().getData(); Log.e("size", allDataList.size() + ""); LoadMoreList(); } } @Override public void onFailure(Call<User_pojo> call, Throwable t) { t.printStackTrace(); t.getMessage(); Log.e("Failed", t.getMessage()); } }); } private void LoadMoreList() { try { Log.e("size", String.valueOf(allDataList.size())); if (allDataList.size() >= itemsCount) { paginationList.clear(); for (int i = 0; i < itemsCount; i++) { paginationList.add(allDataList.get(i)); } Log.e("paginationList_Size", String.valueOf(paginationList.size())); adapter = new Adapter_UserList(context, paginationList); } else { adapter = new Adapter_UserList(context, allDataList); listViewUser.removeFooterView(footerView); // loaded all list then simply remove footerView. } if (footerView != null) footerView.findViewById(R.id.progress_bar).setVisibility(View.INVISIBLE); listViewUser.setAdapter(adapter); } catch (Exception ignored) { } } private Map<String, String> getUserMap() { Map<String, String> map = new HashMap<>(); map.put("uid", "001"); map.put("token", "5526"); Log.e("logs", map.toString()); return map; }

并重新检查您的div标签,并确保您做了正确的元素展示位置。

答案 2 :(得分:0)

看看这是否有帮助!添加了col-xs-12以正确渲染元素的高度。 &#34; *&#34;将是代码中的标识符,用于检查修改。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>

    <style >

    .mobile-select {height:50px;padding-top:15px;padding-left:60px;padding-right:20px}
    </style>


    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    <div class="row breadcrumb bg-white border-bottom paddl30">
      <div class="col-md-6">
        <ul **class="breadcrumb"**>
          <li><a href="">Devices</a></li>
          <li> &gt; </li>
          <li>Screen Analytics</li>
        </ul>
      </div>
    </div>
    <div class="row mobile-select border-bottom">
      <div class="col-md-6 **col-xs-12**">
        <ul class="device-menu bg-white **col-xs-12**">
          <li class="selected **col-xs-12**">
            <a href="javascript:void(0)" id="mobileAppScreens">Mobile</a>
            <span class="sub-menu-menu"> 
                                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
                                        <a href="javascript:void(0)" ng-click="" id="iosMobileAppScreens" class="checked"> <i class="fa fa-apple" aria-hidden="true" ></i> ios</a>

                                        <a href="javascript:void(0)" ng-click="" id="androidMobileAppScreens"><i class="fa fa-android" aria-hidden="true"></i> Android</a>
                                    </span>
            <span class="grey-pipe">|</span>
          </li>
          <li **class="col-xs-12"**>
            <a href="javascript:void(0)" id="tabletAppScreens">Tablet</a>
            <span class="sub-menu-menu hide"> 
                                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
                                        <a href="javascript:void(0)" ng-click="" id="iostabletAppScreens"><i class="fa fa-apple" aria-hidden="true"></i> ios</a>

                                    <a href="javascript:void(0)" ng-click=""  id="androidtabletAppScreens"> <i class="fa fa-android" aria-hidden="true"></i> Android</a>
                                    </span>
          </li>
          <li class="hidden">
            <input type="text" id="selMenu" value="iosMobileAppScreens">
            <input type="text" id="sDate">
            <input type="text" id="eDate">
          </li>
        </ul>

      </div>
      <div class="col-md-6 **col-xs-12**">
        <div id="dateRangescreenAnalytics" class="pull-right">
          <i class="glyphicon glyphicon-calendar txt-green fa fa-calendar"></i>
          <span></span><b class="caret"></b>
        </div>
      </div>
    </div>

<!-- end snippet -->




</html>