在教程之后,我创建了这个布局:
这是我的布局xml文件:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/tabanim_maincontent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/tabanim_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/tabanim_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="@+id/tabanim_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/tabanim_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
我想要的是当我在中间离开滚动时(当App栏的下半部分可见时),然后appbar应该隐藏自己或完全展现自己,就像它在谷歌游戏商店中发生的那样:
请注意,在谷歌播放的情况下,当没有手指触摸屏幕时,应用栏永远不会被隐藏
如何制作这样的应用栏?
谢谢
android appbar android-support-design android-collapsingtoolbarlayout
注意:此问题仅与AppBarButton图标有关.
在编写运行所有外形的UWP应用程序时,我想要包含AppBarButton图标的所有必要变体.
从我到目前为止所读到的内容来看,似乎我需要在五个比例因子中分别使用24x24图标,即100%,125%,150%,200%和400%.换句话说,24x24,30x30,36x36,48x48,96x96.
它是否正确?
另外,如何命名这些以便系统在给定基本名称的情况下正确选择正确的变体?
编辑:我在其他地方读到只需要一个大小,并且Windows UWP在与设备无关的单元中呈现图标(即适当地缩放它).
相比之下,iOS允许将多个图像包含在@ 2x和@ 3x后缀中,Android允许将图像放置在特殊的子目录中,例如dir-hdpi,dir-mdpi,其中dir是基本目录名称.如此看来,UWP并不会有这样的系统,只有一个图标是必要的.此修订后的理解是否正确?
我的Windows 10 UWP应用程序中的图标和文本随机消失了.
图片正在启动.
图片是在点击appbar按钮后,导航到另一个页面,然后再次打开应用栏.
这是控件的XAML:
<Grid DataContext="{Binding AppBarViewModel, Source={StaticResource ViewModelLocator}}">
<StackPanel x:Name="LeftPanel" Orientation="Horizontal" Grid.Column="0" HorizontalAlignment="Left">
<AppBarButton Width="100" x:Name="WelcomeButton" Label="{Binding ConverterParameter=Page_WelcomeTitleLabel, Converter={StaticResource trans}}" Command="{Binding WelcomeCommand}" Visibility="{Binding IsWelcomeButtomVisible, ConverterParameter=false, Converter={StaticResource BooleanToVisibilityConverter}}" >
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/Icons/Home.png" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Width="100" x:Name="ReportButton" Label="{Binding ConverterParameter=Page_ReportTitleLabel, Converter={StaticResource trans}}" Command="{Binding ReportCommand}" Visibility="{Binding IsReportButtonVisible, ConverterParameter=False, Converter={StaticResource BooleanToVisibilityConverter}}">
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/Icons/Report.png" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Width="100" x:Name="IndividualPerformanceButton" Label="{Binding ConverterParameter=Page_IndividualPerformanceTitleLabel, Converter={StaticResource trans}}" Command="{Binding IndividualPerformanceCommand}" Visibility="{Binding IsIndividualButtonVisible, ConverterParameter=False, Converter={StaticResource BooleanToVisibilityConverter}}" >
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/Icons/Individual overview.png" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton …Run Code Online (Sandbox Code Playgroud) 根据材料设计指南:
滚动时,顶部应用程序栏可以以下方式进行转换:
-向上滚动隐藏顶部应用程序栏
-向下滚动显示顶部应用程序栏
当顶部应用程序栏滚动时,其在其他元素上方的高度变得明显。
在material-ui-next中是否有任何内置方法可以执行此操作,还是应将其视为新功能?您能否提示如何按照指南中所述实现AppBar组件的动画?
我知道我可以在Flutter中的AppBar的操作中使用IconButton。但是,我希望用户看到“保存”或“返回”或“取消”一词,而不是图标,然后在AppBar中单击它们。我该如何实现?这是显示AppBar的代码的一部分。我想使用“保存”代替“保存”图标
return Scaffold(
appBar: AppBar(
leading: IconButton(icon: Icon(Icons.arrow_back),
tooltip: "Cancel and Return to List",
onPressed: () {
Navigator.pop(context, true);
},
),
automaticallyImplyLeading: false,
title: Text(title),
actions: <Widget>[
IconButton(
icon: Icon(Icons.save),
tooltip: "Save Todo and Retrun to List",
onPressed: () {
save();
},
)
],
),//AppBar
Run Code Online (Sandbox Code Playgroud) 我正在使用包含背景图像和标题的SliverAppBar。标题文本为白色,我需要在AppBar上将颜色更改为黑色(“减少”)(因为标签栏也为白色)。
怎么做 ?
NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {;
return <Widget>[
SliverAppBar(
expandedHeight: 200.0,
floating: false,
pinned: true,
backgroundColor: Colors.white,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
title: Text(_event.name,
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
)),
background: CachedNetworkImage(
imageUrl: _event?.imageMediumUrl ??
'http://preprod.tibib-live.com/medias/cached-media/medium/5bea5964109aa-c827b05facc3781485e584dac2f4dddc.png',
fit: BoxFit.cover,
)),
),
SliverPersistentHeader(
delegate: _SliverAppBarDelegate(
TabBar(
labelColor: Colors.white,
indicatorColor: Colors.red,
unselectedLabelColor: Colors.grey,
tabs: [
Tab(icon: Icon(Icons.info), text: "Info"),
Tab(icon: Icon(Icons.people), text: "Courses"),
],
),
),
pinned: true,
),
];
},
body: TabBarView(
children: <Widget>[_buildInfo(), _buildTrials()],
),
),
Run Code Online (Sandbox Code Playgroud) appbar ×10
flutter ×6
dart ×3
android ×1
android-collapsingtoolbarlayout ×1
back-button ×1
button ×1
dock ×1
icons ×1
javascript ×1
material-ui ×1
reactjs ×1
tabbar ×1
uwp ×1
uwp-xaml ×1
xaml ×1