In material-ui how do i get a text input in an AppBar to the center?

我怕爱的太早我们不能终老 提交于 2020-01-06 15:28:09

问题


Iv defined an app bar using material-ui (app-bar-docs), and it includes a children attribute which can be used to add content to it (the docs mention things like tabs can be added to the appbar). However, i want to have a text input inside the Appbar, but it ends up to the right, after an iconelementright , how do i get it back to the center? here is the code:

class AppBarExampleIconButton extends React.Component {
  render() {
  return (
  <AppBar
    title={<span style={styles.title}>Title</span>}
    onTitleTouchTap={handleTouchTap}
    iconElementRight={
      <DropDownMenu >
      <MenuItem value={"1"}  primaryText="Six"/>
      <MenuItem value={"2"} primaryText="Five" />
      <MenuItem value={"3"} primaryText="four"/>
      <MenuItem value={"4"} primaryText="three"/>
      <MenuItem value={"5"} primaryText="two"/>
      <MenuItem value={"6"} primaryText="one"/>
      </DropDownMenu>
       } >
   <div key={"21"}  _grid={{x: 2, y: 1, w: 6, h: 2}} > <AutoCompleteExampleNoFilter/> </div>
  </AppBar>);
  }
}

And this is what it looks like:

来源:https://stackoverflow.com/questions/35394176/in-material-ui-how-do-i-get-a-text-input-in-an-appbar-to-the-center

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!