Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >试图让安卓系统上的TabBar不再需要点击标签图标

试图让安卓系统上的TabBar不再需要点击标签图标
EN

Stack Overflow用户
提问于 2019-07-09 07:10:40
回答 1查看 585关注 0票数 1

我正在尝试让我的选项卡图标在单击或不在TabBar中时呈现它们的屏幕。它可以在IOS上工作,但不能在Android上工作。选项卡选择范围似乎只能在TabBar内访问,而不能在外部访问,因为它没有附加到其图标上。当点击它的图标时,有没有办法让它在TabBar之外工作?谢谢

我尝试的另一种方法是将TabBar的高度设置为屏幕的100%,并使其backgroundColor透明,以便看到后面的屏幕,但它显示的是一个白色屏幕,并隐藏了它背后的内容。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
import React from 'react'
import {
  StyleSheet,
  Text,
  View,
  Image
} from 'react-native'
import {
  createBottomTabNavigator,
  createAppContainer
} from 'react-navigation'
import {
  widthPercentageToDP as wp,
  heightPercentageToDP as hp
} from 'react-native-responsive-screen'
class DocSelection extends React.Component {
  render() {
    return ( <
      View style = {
        styles.container
      } >

      <
      Text > CustomerService < /Text>

      <
      /View>



    )
  }
}
class Printing extends React.Component {
  render() {
    return ( <
      View style = {
        styles.container
      } >

      <
      Text > hfhdfjedhfeehfjeh < /Text>

      <
      /View>

    )
  }
}
class Design extends React.Component {
  render() {
    return ( <
      View style = {
        styles.container
      } >

      <
      Text > 874877847484787 < /Text>

      <
      /View>
    )
  }
}
const RouteConfigs = {
    'Home': {
      screen: DocSelection,
      navigationOptions: { //tabBarButtonComponent: tabBarIcon: ({ tintColor, horizontal }) => (
        <
        Image style = {
          {
            margin: 15,
            width: 35,
            height: 35,
            tintColor: "red"
          }
        }
        source = {
          require("../Icons/home.png")
        }
        /> ), }, }, 'Order history':{ screen: Printing, navigationOptions: { backgroundColor: '#262A2C', top:-60, borderTopWidth: 0, tabBarIcon: ({ tintColor }) => ( <
        Image style = {
          {
            width: 32,
            height: 32,
            tintColor: "red"
          }
        }
        source = {
          require("../Icons/history-clock-button.png")
        }
        /> ), }, }, 'Customer service':{ screen: Design, navigationOptions: { tabBarIcon: ({ tintColor }) => ( <
        Image style = {
          {
            top: 0,
            margin: 15,
            width: 40,
            height: 40,
            tintColor: "red"
          }
        }
        source = {
          require("../Icons/customer-service.png")
        }
        /> ), }, }, }; const DrawerNavigatorConfig = { intialRouteName: 'Home', navigationOptions: { tabBarVisible: true }, tabBarOptions: { tabStyle:{ top:-130, height:0 }, showLabel: false, style:{ backgroundColor:"rgba(255, 0, 0, 0)" }, }, }; const Navigator = createBottomTabNavigator(RouteConfigs, DrawerNavigatorConfig);
        export default createAppContainer(Navigator);
        const styles = StyleSheet.create({
          container: {
            flex: 1,
            justifyContent: 'center',
            backgroundColor: '#ecf0f1',
            top: 300
          }
        });

EN

回答 1

Stack Overflow用户

发布于 2019-07-12 15:55:43

如果有任何人对答案感兴趣,您只需创建一个组件并导航到相关选项卡。确保选项卡可见性为false,然后将构件放置在所需位置。这种做法将确保返回到以前的选项卡将保存以前页面上的以前的状态。

如果任何人感兴趣,我可以发布一个例子。目前没有回复,所以我将提交此答案。

我的结构略有不同,但这里有一个更简单的例子,我希望能对你有所帮助:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
import React from 'react';
import {View,TouchableOpacity, PixelRatio, Image} from 'react-native'
import { createBottomTabNavigator, createAppContainer} from 'react-navigation'
import {widthPercentageToDP as wp, heightPercentageToDP as hp} from 'react-native-responsive-screen'

class Home extends React.Component{

render(){
  const {navigation} = this.props;
  const { routeName } = navigation.state;
return(

 <View style={{flex:1,
 backgroundColor:'grey'}}>
              <TouchableOpacity
                activeOpacity={0.7}
                onPress={() => {
                  navigation.navigate("Home")
              }}
                style={ {position: 'relative',
                width:  PixelRatio.get() <= 2 ? 40 : 45,
                height: PixelRatio.get() <= 2 ? 40 : 45,
                alignItems: 'center',
                justifyContent: 'center',
                left: wp('5%'),
                top: hp('11.5%'),
                backgroundColor:routeName==="Home" ? 'black' : 'white' ,
                borderRadius: PixelRatio.get() <= 2 ? 40/2 : 45/2}}>
                <Image

                source={require("./Icons/category.png")} 
                //pay FlatIcon or design personal one
                style={{ resizeMode: 'contain',
                width: PixelRatio.get() <= 2 ? 25 : 30,
                height: PixelRatio.get() <= 2 ? 25 : 30,
                tintColor: routeName==='Home'?'#81F018' : '#262A2C',
                }}
                />
                </TouchableOpacity>
                <TouchableOpacity
                  activeOpacity={0.7}
                  onPress={() => {
                    navigation.navigate("Alt")
                }}
                  style={ {position: 'relative',
                  width:  PixelRatio.get() <= 2 ? 40 : 45,
                  height: PixelRatio.get() <= 2 ? 40 : 45,
                  alignItems: 'center',
                  justifyContent: 'center',
                  left: wp('5%'),
                  top: hp('11.5%'),
                  backgroundColor:routeName==="Alt" ? 'black' : 'white' ,
                  borderRadius: PixelRatio.get() <= 2 ? 40/2 : 45/2}}>
                  <Image

                  source={require("./Icons/category.png")} 
                  //pay FlatIcon or design personal one
                  style={{ resizeMode: 'contain',
                  width: PixelRatio.get() <= 2 ? 25 : 30,
                  height: PixelRatio.get() <= 2 ? 25 : 30,
                  tintColor: routeName==='Alt'?'#81F018' : '#262A2C',
                  }}
                  />
                  </TouchableOpacity>
              </View>)}}



class Alt extends React.Component{

  render(){
    const {navigation} = this.props;
    const { routeName } = navigation.state;
  return(

   <View style={{flex:1,
   backgroundColor:'white'}}>
   <TouchableOpacity
                activeOpacity={0.7}
                onPress={() => {
                  navigation.navigate("Home")
              }}
                style={ {position: 'relative',
                width:  PixelRatio.get() <= 2 ? 40 : 45,
                height: PixelRatio.get() <= 2 ? 40 : 45,
                alignItems: 'center',
                justifyContent: 'center',
                left: wp('5%'),
                top: hp('11.5%'),
                backgroundColor:routeName==="Home" ? 'black' : 'white' ,
                borderRadius: PixelRatio.get() <= 2 ? 40/2 : 45/2}}>
                <Image

                source={require("./Icons/category.png")} 
                //pay FlatIcon or design personal one
                style={{ resizeMode: 'contain',
                width: PixelRatio.get() <= 2 ? 25 : 30,
                height: PixelRatio.get() <= 2 ? 25 : 30,
                tintColor: routeName==='Home'?'#81F018' : '#262A2C',
                }}
                />
                </TouchableOpacity>
                <TouchableOpacity
                  activeOpacity={0.7}
                  onPress={() => {
                    navigation.navigate("Alt")
                }}
                  style={ {position: 'relative',
                  width:  PixelRatio.get() <= 2 ? 40 : 45,
                  height: PixelRatio.get() <= 2 ? 40 : 45,
                  alignItems: 'center',
                  justifyContent: 'center',
                  left: wp('5%'),
                  top: hp('11.5%'),
                  backgroundColor:routeName==="Alt" ? 'black' : 'white' ,
                  borderRadius: PixelRatio.get() <= 2 ? 40/2 : 45/2}}>
                  <Image

                  source={require("./Icons/category.png")} 
                  //pay FlatIcon or design personal one
                  style={{ resizeMode: 'contain',
                  width: PixelRatio.get() <= 2 ? 25 : 30,
                  height: PixelRatio.get() <= 2 ? 25 : 30,
                  tintColor: routeName==='Alt'?'#81F018' : '#262A2C',
                  }}
                  />
                  </TouchableOpacity>
                </View>)}}
const AppTabNavigator = createBottomTabNavigator({



  "Home": {
    screen: Home,

 },


  "Alt": {
    screen: Alt,

 },


   }, 
   {
       defaultNavigationOptions: {

           tabBarVisible: false
         },


   }
   )
export default createAppContainer(AppTabNavigator)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56947105

复制
相关文章
纯Power Automate打造的Power BI无限刷新
API的优点是官方认证,且可实现异步刷新(点击上方链接访问),操纵感比较强;缺点也很明确,pro账户8次。
陈学谦
2022/04/08
3.6K0
纯Power Automate打造的Power BI无限刷新
深度长文:Power Automation 帮助企业实现数字化转型
在Ignite 2019上,我们宣布将Flow更改为Power Automate,并在UI Flow连接器的公开预览中引入了机器人流程自动化(RPA)。我们对几种激动人心的功能感到兴奋,这些功能将在今年全面上市,并想花一点时间回顾一下将我们带到这里的过程,以便您简要了解一些最重要的功能,这些功能现在已成为Power Automate的一部分,确保它是贵组织最全面,最先进的自动化服务。
寒树Office与RPA
2020/03/12
2.6K0
搞定了!Power Automate云端调用PAD
自从学习 PAD 以来,一直想通过 Power Automate 云端来调用 Power Automate Desktop (PAD),碍于其高级许可证的限制,好久都没搞定。
披头
2022/12/19
1.1K0
搞定了!Power Automate云端调用PAD
打破不同组织间的壁垒,Power Automate同步Power BI报告
学谦数据集团下设多个部门,其中财务部和运营部的小伙伴先后独立购买了全球版的Power BI pro账号10个和15个各自开发报告(都怪学谦疏于管理)。由于是分开独立购买,因此域名自然是不同的,即分属两个不同的组织。
陈学谦
2022/10/30
1.3K0
打破不同组织间的壁垒,Power Automate同步Power BI报告
使用Power Automate在Onedrive for Business中创建空文件夹
在Onedrive for Business(以下简称ODB)中创建一个文件是非常轻松的一件事:
陈学谦
2023/01/03
3.7K0
使用Power Automate在Onedrive for Business中创建空文件夹
RPA之PAD(Power Automate Desktop) 产品介绍
基于RPA,有很多的产品,其中 Power Automate Desktop (PAD)就是一个相对来讲,免费的,容易使用的一个RPA,另外它的国际化做的也很不错,中文效果也是很棒。
沙漠尽头的狼
2022/06/13
1.5K0
RPA之PAD(Power Automate Desktop) 产品介绍
RPA之PAD(Power Automate Desktop)组件开发
只要有一扇门,就会有一个世界,现在已经有了一扇门(毕竟是.Net Framework,那么,研究借鉴就容易多了)。
沙漠尽头的狼
2022/06/13
9650
RPA之PAD(Power Automate Desktop)组件开发
使用Power Automate Desktop实现业务自动跟踪管理
今年年初被学谦老师带入office365大门,跟着谦老师陆陆续续接触了很多“黑科技”,但都学艺不精,任重而道远。这次结合自身业务向大家分享一个自动化应用案例,其实并没有什么创新,只是结合自己身业务的一个自动化实践小案例,因此叫作业分享可能更合适。
陈学谦
2022/10/30
9410
使用Power Automate Desktop实现业务自动跟踪管理
Power Automate导出Power BI数据为CSV格式中文乱码解决方案
自然的,第三方的工具肯定是需要API密钥的,而且大部分也都是收费的,我们根据上面的链接打开看看,是个英文网站:
陈学谦
2022/04/11
2.7K0
Power Automate导出Power BI数据为CSV格式中文乱码解决方案
为什么玩转 Power BI 一定需要 Office 365?
BI工具数不胜数,Power BI、Tableau、FineBI、永洪BI、百度智能云等,甚至 python、MATLAB 都可以实现报表功能。
陈学谦
2022/10/30
5.4K0
为什么玩转 Power BI 一定需要 Office 365?
Power Automate从Excel获取日期如何格式化
最近在做一个项目,用到了Power Automate从excel online中获取一个表提交到流数据集中。
陈学谦
2022/02/17
4.6K0
Power Automate从Excel获取日期如何格式化
Power Automate实现PowerBI数据集刷新结束后通知
本文为PowerBI REST API高级应用教程,需要有REST API基础,并且能够自行获取token的基础上进行操作。
陈学谦
2022/05/25
2.1K0
Power Automate实现PowerBI数据集刷新结束后通知
用PAD发送键自动刷新Power BI,还能操作所有菜单功能 | Power Automate实战
很多朋友在尝试用Power Automate去控制Power BI,实现数据的自动刷新。
大海Power
2022/11/07
1.7K0
用PAD发送键自动刷新Power BI,还能操作所有菜单功能 | Power Automate实战
从Power Automate到Power BI实时流数据集:翻山越岭的问题解决
了解PowerAutomate已经有较长的时间,但是一直没有尝试过,最近刚好手头一个略微复杂的问题,Trello和Microsoft to-do的同步,发现在PA中竟然有现成的模板可以直接同步,就认真研究了两天,实现了一些其他的操作,比如:
陈学谦
2021/12/27
2K0
从Power Automate到Power BI实时流数据集:翻山越岭的问题解决
数值、文本怎么表示?怎么互相转换? | Power Automate重要基础
关于数据类型、变量以及取值,是使用任何一项与计算机及数据处理相关工具必须掌握的基础内容!当然,Power Automate也一样,这些基础的内容,不难,但必须会!主要包括的基本变量类型有:数值、文本、布尔(真假)、列表、表格。
大海Power
2022/04/11
3.7K1
数值、文本怎么表示?怎么互相转换? | Power Automate重要基础
怎么自动登录公司系统、导出数据? | Power Automate实战案例
GAI前面的案例《第1例:BHSI指数网站有防爬?那就自动打开复制下来!| Power Automate实战案例》里讲了从公开网站跳过浏览器检测(防爬)的情况,接下来我们讲一个很多朋友关心的登录公司内部系统导出数据的例子。
大海Power
2021/10/13
4.9K0
如何使用Power Automate定时给员工发送生日邮件
我们从谷歌上找到关于如何使用Power Automate发送生日邮件的方法,但是他们是对,但不全对。
繁华是客
2023/03/03
2.6K0
如何使用Power Automate定时给员工发送生日邮件
RPA办公自动化 | power automate&飞书捷径
先声明一下,我不是从一个专家的角度来讲RPA软件的,相反是从一个学习者的角度来讲的,结论不一定完全正确。
做数据的二号姬
2023/09/06
1.6K0
RPA办公自动化 | power automate&飞书捷径
Power Automate表达式无法输入和修改时的处理办法
自从flow的主页改为https://make.powerautomate.com,速度是快了不少,但是好像bug也多了起来。
陈学谦
2022/10/30
1.3K5
Power Automate表达式无法输入和修改时的处理办法
鱼和熊掌兼得,Power Automate解决forms对OneDrive的同步问题
本文主要介绍了在教育背景下的forms测验表单使用和与onedrive和Power BI的配合时的不可同步的问题,并尝试使用Power Automate来实现鱼和熊掌兼得的目的。
陈学谦
2021/12/15
2.8K0
鱼和熊掌兼得,Power Automate解决forms对OneDrive的同步问题

相似问题

Power Automate Flow错误,拒绝访问(创建共享链接)

111

是否可以在SharePoint站点模板中包含Flow/Power Automate?

144

使用HTTP Request或fromo Power Automate flow触发管道

122

难以使用MS-Flow - Power Automate处理JSON

113

Power Automate flow不会为已存在的文件触发"Copy To“操作

138
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文