我目前有一项主要活动申请。我需要在底部添加导航栏。我计划在这个导航栏中有三件事(家庭,帮助,设置)。现在我倾向于添加带有来自http://www.truiton.com/2017/01/android-bottom-navigation-bar-example/
的片段的导航栏但它只适用于片段。我需要的是,当我点击回家时,我需要去MainActivity页面,这个抽屉也应该在所有活动中出现
答案 0 :(得分:-1)
Android支持库function isValid(list) {
var arrList = list.split(",");
if (arrList.length > 7) { // if more than 7, there are duplicates
return false;
}
var temp = {};
for (var i in arrList) {
if (arrList[i] === "") return false; // if empty element, not valid
temp[arrList[i]] = "";
}
if (Object.keys(temp).length !== arrList.length) { // if they're not of same length, there are duplicates
return false;
}
return true;
}
console.log(isValid("2,4,6,7,1")); // true
console.log(isValid("2,2,6")); // false
console.log(isValid("2")); // true
console.log(isValid("2,")); // false
console.log(isValid("1,2,3,4,5,6,7,8")); // false
console.log(isValid("1,2,3")); // true
console.log(isValid("1,2,3,7,7")); // false
提出了我认为您需要的新compile 'com.android.support:design:25.0.0'
。
请参阅此链接https://androidresearch.wordpress.com/2016/10/29/android-bottomnavigationview-example/
它显示bottomnavigationview
有三个片段。正确阅读整个博客,您可以根据需要自行定制。