我正在制作一个包含4个不同页面的项目。我使用“ BottomNavigationBar”小部件导航到每个页面。当按下“ BottomNavigationBar”中的图标时,我在支架体内显示了不同的页面。我不使用任何路由,因此当用户在Android上按下时,该应用程序将关闭。我不想发生的事情。
我找到的所有指南在导航时都会重新加载整个“ Scaffold”,但是我只想更新“ Scaffold”小部件的“ body”属性。当Navigation.pop()发生a 时,我再次只希望更改“脚手架”主体。
我可以尝试的另一种解决方法是创建自定义历史记录列表,然后在页面更改时更新该列表。按下后退按钮时,捕获OnWillPop事件以更新页面。我没有尝试过,因为我觉得必须有更好的方法。
显示页面的脚手架小部件。
Widget createScaffold() {
return Scaffold(
backgroundColor: Colors.white,
appBar: EmptyAppBar(),
body: _displayedPage,
bottomNavigationBar: createBottomNavigationbar(),
);
}
Run Code Online (Sandbox Code Playgroud)
BottomNavigationBar小部件。
Widget createBottomNavigationbar() {
return BottomNavigationBar(
type: BottomNavigationBarType.fixed,
currentIndex: _selectedIndex,
onTap: _onItemTapped,
items: [
BottomNavigationBarItem(
icon: new Icon(Icons.home,
color: _selectedIndex == 0 ? selectedColor : unselectedColor),
title: new Text('Home',
style: new TextStyle(
color:
_selectedIndex == 0 ? selectedColor : unselectedColor)),
),
BottomNavigationBarItem(
icon: new Icon(Icons.show_chart,
color: _selectedIndex == …Run Code Online (Sandbox Code Playgroud) 当我试图打印出我的2维String数组时,我收到一条错误消息:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
at MainClass.main(MainClass.java:51)
Run Code Online (Sandbox Code Playgroud)
这是我的阵列:
String[][] list = {
{"1",null},
{"2",null},
{"3",null},
{"4",null},
{"5",null},
{"6",null},
{"7",null},
{"8",null},
{"9",null},
{"10",null},
{"11",null},
{"12",null},
{"13",null},
{"14",null},
{"15",null}
};
Run Code Online (Sandbox Code Playgroud)
这就是我打印它的方式:
for( int row=0; row<list.length; row++) {
for( int col=0; col<list.length; col++) {
System.out.print(list[row][col] + "\t"); //this is MainClass:java:51 where the error is happenin
}
System.out.println();
}
Run Code Online (Sandbox Code Playgroud)
我试图以漂亮的网格形状打印出来.我现在这样做的方式是为Integr数组而工作,这让我感到很困惑.
java eclipse arrays multidimensional-array indexoutofboundsexception
这是我的html:
<a id="test" href="monogram/index.html">
<img src="img/MonogramApartmentNS.png" alt="The image">
</a>
Run Code Online (Sandbox Code Playgroud)
这是CSS:
#test {
display: inline-block;
width: 40.0rem;
}
#test img {
width: 100%;
}
Run Code Online (Sandbox Code Playgroud)
图像链接有效。在 css 中,我将 设定为显示为内联块,但 的高度与 img 的高度不匹配。它比它包含的图像高 5 像素。我如何获得与它包含的图像完全相同的高度?我需要这个,因为我在标签周围使用边框。
我正在使用Live Charts库,但遇到了一个问题,其中y轴的最小值为“ -1000”。
如何将其设置为0?我尝试在Yaxis集合下的winforms中,将那里的MinValue设置为0,但这似乎无济于事。
这是我绘制图表的方式:
cartesianChart1.Series.Add(
new LineSeries
{
Title = "Series 1",
Values = graph1.ReturnGraphData().AsChartValues(),
LineSmoothness = 0, //straight lines, 1 really smooth lines
PointGeometry = null,
PointGeometrySize = 0,
});
Run Code Online (Sandbox Code Playgroud)
方法“ ReturnGraphData()”返回一个int数组。
这也是我在winforms设计器中对YAxis的设置:
就像我之前说过的,当我在属性中将MinValues设置为0时,它什么也不做或使Visual Studio崩溃。它也恢复为NaN。