我正在使用带有 SafeAreaView 的标签栏导航器。
如果我注释掉标签栏导航,父视图将覆盖整个屏幕。但是,当我添加标签栏时,它会在标签栏部分下显示一个小的白色视图。
const App = () => {
return (
<SafeAreaView style={styles.droidSafeArea}>
<View style={{ backgroundColor: "red", flex: 1 }}>
<TabNavigator key="MainTabNav" />
</View>
</SafeAreaView>
);
};
export default App;
const styles = StyleSheet.create({
droidSafeArea: {
flex: 1,
backgroundColor: "#2F3438",
}
});
Run Code Online (Sandbox Code Playgroud)
如何在 TabBar 顶部添加一条线/分隔符,以便在视图和 TabBar 之间添加某种分隔符?
我的屏幕底部有一个容器,它有一个 BottomNavigationBar。我希望容器获得我的背景颜色。即使在添加 CLipRRect 之后,它也没有得到纠正。我还尝试使容器透明,但它显示了一个错误,我无法为我的容器分配颜色并给它一个 boxDecoration。我希望多余的白色部分合并到我的背景中。
//编辑
Widget _bottomNavigationBar(int selectedIndex) => ClipRect(
child: Container(
height: 80,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(52.0)),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.withOpacity(0.3),
offset: const Offset(0.0, 0.0),
blurRadius: 52.0),
],
),
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(52.0),
topRight: Radius.circular(52.0)),
child: BottomNavigationBar(
selectedItemColor: Color(0xFFFE524B),
unselectedItemColor: Color(0xFFFF8C3B),
onTap: (int index) => setState(() => _selectedIndex = index),
currentIndex: selectedIndex,
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(
Entypo.home,
size: 30,
),
title: Text('')),
BottomNavigationBarItem(
icon: Icon(
Entypo.game_controller,
size: 30,
),
title: Text('[![enter …Run Code Online (Sandbox Code Playgroud) 我的 VC 以stackViewAttached开头Align Bottom to Safe Area。
我有 tabBar,但一开始是隐藏的tabBar.isHidden = true。
稍后,当 tabBar 出现时,它会隐藏stackView
所以我需要在之后刷新约束的函数tabBar.isHidden = false
当我启动应用程序时,会正确tabBar.isHidden = false显示stackView。
尝试过每个功能,例如:stackView.needsUpdateConstraints() , updateConstraints() , setNeedsUpdateConstraints()没有成功。
现在我正在以编程方式更改底部,但是当我切换 tabBarIndex 并返回到更改了底部约束的那个索引时,它会检测到 tabBar 并在另一个视图(未附加约束)下提升 stackView 。就像是再次刷新了约束。我正在隐藏并显示此 stackView,并在屏幕上/屏幕外进行限制。
我需要在 tabBar.isHidden = false 之后刷新约束,但约束不会检测 tabBar 的外观。
正如我提到的,在 tabBar 之间切换可以解决问题,因此在切换后会执行一些代码来检测 tabBar。有人知道这段代码吗?我尝试调用方法 viewDidLayoutSubviews 和 viewWillLayoutSubviews 但没有成功......有什么建议吗?
上下文:我有当前的设计 - 显示在下面的屏幕截图中 - 我Tab静态实现了s,
问题:我们如何Tab使用来自服务器的动态值动态创建s?
例如,服务器发送超过 5Tab秒。
我当前的实现包含一个 AppBar,它支持一个TabBar带有标签的小部件列表
这是标签栏的代码片段:
bottom: TabBar(
labelPadding: EdgeInsets.symmetric(horizontal: 20),
indicatorColor: kDarkColor,
labelColor: kDarkColor,
indicatorWeight: 2,
unselectedLabelColor: Colors.black,
isScrollable: true,
tabs: [
Tab(child: Text('Timeline.mostPopularTab'.tr())),
Tab(child: Text('Timeline.menTab'.tr())),
Tab(child: Text('Timeline.womenTab'.tr())),
Tab(child: Text('Timeline.kidsTab'.tr())),
],
),
Run Code Online (Sandbox Code Playgroud) 我使用默认的底部在Xamarin.Forms.Shell应用程序上工作TabBar,我需要知道调整一些项目的TabBar 高度。
我已经找到一种方法来获得StatusBar 高度在两个平台上有,但我没有找到的一个解决方案TabBar。
是否可以?我只找到了关于在 Stack 上更改 TabBar 高度的请求...
我尝试对整个容器进行舍入,但我不知道如何根据所选选项卡舍入指示器。我现在有这个标签栏。
import 'package:flutter/material.dart';
class AppTabBar extends StatefulWidget {
final TabController? tabController;
const AppTabBar({Key? key, required this.tabController}) : super(key: key);
@override
_AppTabBarState createState() => _AppTabBarState();
}
class _AppTabBarState extends State<AppTabBar> {
@override
Widget build(BuildContext context) {
return Container(
height: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.vertical(bottom: Radius.circular(10.0)),
border: Border.all(color: Color.fromRGBO(27, 189, 198, 1))),
child: TabBar(
controller: widget.tabController,
indicator: BoxDecoration(
color: Color.fromRGBO(27, 189, 198, 1),
),
labelColor: Color.fromRGBO(238, 248, 254, 1),
unselectedLabelColor: Color.fromRGBO(238, 248, 254, 1),
tabs: [
Tab(
text: 'first',
),
Tab( …Run Code Online (Sandbox Code Playgroud) 是否有一种常见的方法来禁用flex 4中的spark tabbar组件的选项卡?使用mx tabnavigator组件,您只需禁用与选项卡对应的内容,然后也禁用选项卡.但使用spark tab bar组件执行此操作仅禁用内容而不禁用选项卡.
这是我的简单例子:
<mx:TabNavigator x="122" y="155" width="200" height="200">
<s:NavigatorContent label="Tab 1" width="100%" height="100%">
<s:Label text="Label1"/>
</s:NavigatorContent>
<s:NavigatorContent label="Tab 2" width="100%" height="100%" enabled="false">
<s:Label text="Label2"/>
</s:NavigatorContent>
<s:NavigatorContent label="Tab 3" width="100%" height="100%">
</s:NavigatorContent>
</mx:TabNavigator>
<s:TabBar x="368.7" y="100.35" dataProvider="{viewstack1}" />
<mx:ViewStack x="364" y="133" id="viewstack1" width="200" height="200">
<s:NavigatorContent label="Tab 1" width="100%" height="100%">
<s:Label text="Label1"/>
</s:NavigatorContent>
<s:NavigatorContent label="Tab 2" width="100%" height="100%" enabled="false">
<s:Label text="Label2"/>
</s:NavigatorContent>
<s:NavigatorContent label="Tab 3" width="100%" height="100%">
<s:Label text="Label3" x="1" y="0"/>
</s:NavigatorContent>
</mx:ViewStack>
Run Code Online (Sandbox Code Playgroud)
很多,弗洛里安
我通过本教程并为iPhone创建了一个照片库.现在我想将它添加到我的TabBar项目中.我已经听说过,Three20不支持XIB,所以我将整个标签栏设置改为以编程方式.我想我离最终的解决方案并不太远.
我能够让照片库在一个标签中工作,但没有功能(点击图片 - >打开,等等).页面顶部没有导航,可以引导您进入详细图像页面.当我从app delegate中的didFinishLaunchingWithOptions-method中删除它时,我遇到了这个问题:
// Override point for customization after application launch
TTNavigator* navigator = [TTNavigator navigator];
TTURLMap* map = navigator.URLMap;
[map from:@"demo://album" toViewController: [AlbumController class]];
[navigator openURLAction:[TTURLAction actionWithURLPath:@"demo://album"]];
return YES;
Run Code Online (Sandbox Code Playgroud)
我不得不将其删除,否则整个标签栏都不会显示.照片库使用整个屏幕.我不确定它是否未显示或未加载.我也尝试过:
tabbar.hidesBottomBarWhenPushed = NO;
Run Code Online (Sandbox Code Playgroud)
但那根本不起作用.我试图在没有结果的情况下将TTNavigator代码添加到AlbumController本身的loadView(),viewDidLoad()和init().有谁知道我必须把它放在哪里,以使其工作?
我的AlbumController.h:
#import <Foundation/Foundation.h>
#import <Three20/Three20.h>
@interface AlbumController : TTThumbsViewController {
// images
NSMutableArray *images;
// parser
NSXMLParser * rssParser;
NSMutableArray * stories;
NSMutableDictionary * item;
NSString * currentElement;
NSMutableString * currentImage;
NSMutableString * currentCaption;
}
@property (nonatomic, retain) NSMutableArray *images;
@end …Run Code Online (Sandbox Code Playgroud) 我想从故事板创建一个标签栏,我创建它,但当单击标签栏时,图像没有显示和一些图像我想要标签栏像
而我得到这个
当我点击其显示的任何标签栏项目时
这是我在配置文件视图控制器中使用的代码
class ProfileViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
UIApplication.shared.statusBarStyle = .default
self.tabBarController?.tabBar.isHidden = false
UITabBar.appearance().tintColor = UIColor.init(patternImage: UIImage.init(named: "ic_home_tab_profile_sel.png")!)
// Do any additional setup after loading the view.
}
}
Run Code Online (Sandbox Code Playgroud)
任何帮助都可以欣赏.先感谢您.