我有一个使用Android Studio的菜单 $(".treeviewLinks").click(function (e) {
e.preventDefault();
var targetElement = e.target || e.srcElement;
/*** Create everything for the upper tabs that open when tree view link is clicked ***/
if ($(".tabHelper").find("#upperTab").length == 0) {
var ul = document.createElement("ul");
ul.className = "nav nav-tabs";
ul.id = "upperTab";
ul.setAttribute("role", "tablist");
$(".tabHelper").append(ul);
}
var ul = $("#upperTab");
var id = $('#upperTab li').size() + 1;
var li = document.createElement("li");
var a = document.createElement("a");
var span = document.createElement("span");
li.setAttribute("role", "presentation");
a.href = "#" + id;
a.setAttribute("aria-controls", id);
a.setAttribute("role", "tab");
a.setAttribute("data-toggle", "tab");
span.className = "glyphicon glyphicon-remove pull-right exit";
a.innerHTML = targetElement.innerHTML;
if ($(".tabHelper").find(".tab-content").length == 0) {
var tabContentDiv = document.createElement("div");
tabContentDiv.className = "tab-content";
}
$(".tabHelper").append(tabContentDiv);
var tabContentDiv = $(".tabHelper").find(".tab-content").first();
var tabPanelDiv = document.createElement("div");
tabPanelDiv.className = "tab-pane"
tabPanelDiv.id = id;
tabPanelDiv.setAttribute("role", "tabpanel");
ul.append(li);
li.appendChild(a);
a.appendChild(span);
tabContentDiv.append(tabPanelDiv);
var upperTab = document.getElementById("upperTab");
var tabContent = document.getElementsByClassName("tab-content")[0];
var cId = $(tabContent).size() + 1;
if (id == 1) {
var tmpLi = upperTab.firstChild;
tmpLi.className = "active";
}
else if (id > 1) {
$(li).siblings().removeClass("active");
li.className = "active";
}
if (cId == 1) {
var tmpTabPane = tabContent.firstChild;
tmpTabPane.className += " active";
}
else if (cId > 1) {
$(tabPanelDiv).siblings().removeClass("active");
tabPanelDiv.className += " active";
}
/*** Create ul for nav-tabs and tab-content for query and dimension builder tabs ***/
var qdUl = document.createElement("ul");
qdUl.className = "nav nav-tabs query-dimension-tabs";
qdUl.setAttribute("role", "tablist");
var qdDiv = document.createElement("div");
qdDiv.className = "tab-content query-dimsension-tabs-content";
for (var i = 0; i < tabContent.childNodes.length; i++) {
var item = $(tabContent.childNodes[i]);
if (item.children().length < 1) {
item.append(qdUl);
item.append(qdDiv);
}
}
/*** Create li in nav-tabs and tab-panel in tab-content for query and dimension builder tabs ***/
var qLi = document.createElement("li");
var dLi = document.createElement("li");
qLi.setAttribute("role", "presentation");
qLi.className = "active";
dLi.setAttribute("role", "presentation");
var navTabs = $(".query-dimension-tabs");
var qA = document.createElement("a");
var dA = document.createElement("a");
qA.setAttribute("role", "tab");
qA.setAttribute("data-toggle", "tab");
qA.innerHTML = "Query Builder";
dA.setAttribute("role", "tab");
dA.setAttribute("data-toggle", "tab");
dA.innerHTML = "Dimension Builder";
for (var i = 0; i < navTabs.length; i++) {
var item = $(navTabs[i]);
if (item.children().length < 1) {
item.append(qLi);
item.append(dLi);
qLi.appendChild(qA);
dLi.appendChild(dA);
}
}
var qdId = 0;
$(".query-dimension-tabs").each(function () {
$(this).find("a").each(function () {
$(this).attr("href", "#tab" + qdId);
$(this).attr("aria-controls", "tab" + qdId);
++qdId;
});
});
var tabPane1 = document.createElement("div");
var tabPane2 = document.createElement("div");
tabPane1.className = "tab-pane active";
tabPane1.setAttribute("role", "tabpanel");
tabPane2.className = "tab-pane";
tabPane2.setAttribute("role", "tabpanel");
$(".tab-content:not(:first)").each(function () {
$(this).append(tabPane1);
$(this).append(tabPane2);
});
var pId = 0;
$(".query-dimsension-tabs-content").each(function () {
$(this).find(".tab-pane").each(function () {
$(this).attr("id", "tab" + pId);
++pId;
});
if (!($.contains($(this), "form"))) {
var firstPane = $($(this).children()[0]);
var secondPane = $($(this).children()[1]);
firstPane.load("/Webfront/QueryBuilder");
secondPane.load("/Webfront/DimensionBuilder");
}
});
//var url = '@Url.Action("QueryDimensionTab", "Webfront")';
/*** Add CodeMirror to convert all textboxes, needs timeout until all dom elements are loaded ***/
setTimeout(function () {
var textAreaId = 0;
$(".AI-textarea").each(function () {
$(this).attr("id", "text" + textAreaId);
++textAreaId;
});
var queryArr = [];
var dimensionArr = [];
var queryBuilder = $(tabPanelDiv).find(".QueryBuilder");
queryBuilder.each(function (index, el) {
var editorQuery = CodeMirror.fromTextArea(el, {
lineNumbers: true,
tabMode: "indent",
mode: "text/x-sql",
theme: "eclipse"
});
queryArr.push(editorQuery);
});
var dimensionBuilder = $(tabPanelDiv).find(".DimensionBuilder");
dimensionBuilder.each(function (index, el) {
var editorQuery = CodeMirror.fromTextArea(el, {
lineNumbers: true,
tabMode: "indent",
mode: "text/x-sql",
theme: "eclipse"
});
dimensionArr.push(editorQuery);
});
for (var i = 0; i < queryArr.length; i++) {
queryArr[i].refresh();
}
for (var a = 0; a < dimensionArr.length; a++) {
dimensionArr[a].refresh();
}
}, 100);
});
创建的活动 - &gt; New Activity
。
它创建了一个布局,当我运行它时,我可以滚动每一页,工具栏也会滚动。这是我想要的行为,但为什么工具栏卡在通知栏中?为什么它不能向上滚动以便完全隐藏?
在图像上,您可以看到标题MyActivity。因此,当我将内容滚动到底部时,工具栏会卡在此位置,并且不会向上滚动,也不会在屏幕外显示。
Tabbed activity
这就是布局
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>