- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我必须对“编辑服务” Activity 中显示的折扣 fragment 和编辑服务 fragment 进行分段。
当我返回编辑服务 fragment 时,折扣 fragment 上显示的后退箭头箭头消失我想显示它以从编辑服务 Activity 导航上一个 Activity 。
Activity 布局
..................................................... …………
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_hesham"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:title="@string/edit_service"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:layout_constraintTop_toTopOf="parent" />
<fragment
android:id="@+id/nav_host_edit_service"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@+id/toolbar_hesham"
app:layout_constraintBottom_toBottomOf="parent"
app:defaultNavHost="true"
app:navGraph="@navigation/edit_service_nav" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include layout="@layout/confirm_request_bottom_sheet"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
public class EditServicesActivity extends BaseActivity<MainViewModel> {
public Toolbar toolbar;
public NavController navController;
@Override
protected void initActivityComponent() {
component = ProServeTechApp.getComponent(this)
.plus(new ActivityModule(this));
component.inject(this);
}
@Override
protected int getLayout() {
return R.layout.activity_edit_services;
}
@Override
protected Class<MainViewModel> getViewModelClass() {
return MainViewModel.class;
}
@Override
protected void initActivity() {
viewModel.getRequestDetails(getIntent().getExtras().getString("requestId"), String.valueOf(0));
viewModel.getIssues(getIntent().getStringExtra("requestId"));
toolbar = findViewById(R.id.toolbar_hesham);
setSupportActionBar(toolbar);
navController = Navigation.findNavController(this, R.id.nav_host_edit_service);
NavigationUI.setupWithNavController(toolbar, navController );
}
}
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/edit_service_nav"
app:startDestination="@id/edi_service_fragment">
<fragment
android:id="@+id/edi_service_fragment"
android:name="com.unicomg.proservetech.ui.requestdetails.edit.service.fragments.EditServiceFragment"
android:label="@string/edit_service"
tools:layout="@layout/edit_service_fragment">
<action
android:id="@+id/action_edi_service_fragment_to_discount_fragment"
app:destination="@id/discount_fragment"
app:enterAnim="@anim/slide_up"
app:exitAnim="@anim/slide_bottom"
app:popEnterAnim="@anim/slide_up"
app:popExitAnim="@anim/slide_bottom" />
</fragment>
<fragment
android:id="@+id/discount_fragment"
android:name="com.unicomg.proservetech.ui.requestdetails.edit.service.fragments.DiscountFragment"
android:label="@string/add_discount"
tools:layout="@layout/discount_fragment">
</fragment>
</navigation>
最佳答案
根据 setupWithNavController(Toolbar, NavController)
documentation :
The start destination of your navigation graph is considered the only top level destination. On all other destinations, the Toolbar will show the Up button.
AppBarConfiguration
的版本。 .
AppBarConfiguration
允许您准确设置您想要作为顶级目的地的目的地。要在每个目的地上显示向上按钮,您将使用一组空的顶级目的地:
AppBarConfiguration appBarConfiguration =
new AppBarConfiguration.Builder().build();
setSUpportActionBar()
,您应该关注
Action Bar documentation并使用
setupActionBarWithNavController()
方法而不是
Toolbar
版本。您还必须覆盖
onSupportNavigateUp()
处理向上按钮。
public class EditServicesActivity extends BaseActivity<MainViewModel> {
public Toolbar toolbar;
public AppBarConfiguation appBarConfiguation;
public NavController navController;
@Override
protected void initActivityComponent() {
component = ProServeTechApp.getComponent(this)
.plus(new ActivityModule(this));
component.inject(this);
}
@Override
protected int getLayout() {
return R.layout.activity_edit_services;
}
@Override
protected Class<MainViewModel> getViewModelClass() {
return MainViewModel.class;
}
@Override
protected void initActivity() {
viewModel.getRequestDetails(getIntent().getExtras().getString("requestId"), String.valueOf(0));
viewModel.getIssues(getIntent().getStringExtra("requestId"));
toolbar = findViewById(R.id.toolbar_hesham);
setSupportActionBar(toolbar);
navController = Navigation.findNavController(this, R.id.nav_host_edit_service);
appBarConfiguration = new AppBarConfiguration.Builder().build();
NavigationUI.setupActionBarWithNavController(this, navController,
appBarConfiguration);
}
@Override
public boolean onSupportNavigateUp() {
return NavigationUI.navigateUp(navController, appBarConfiguration)
|| super.onSupportNavigateUp();
}
}
关于android - (导航组件)返回首页fragment时如何在activity上显示返回箭头?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60173227/
给定默认路由,以下任一 URL 将导航到 Home Controller 的 Index 方法: 1. http://localhost 2. http://localhost/Home/Inde
可以在“设置”>“阅读”下找到 WordPress 阅读设置。 我将 WordPress 的“首页显示”选项设置为“静态首页”。 我的“首页”设置为“关于”。 我正在尝试为注销和登录用户设置不同的首页
我正在尝试禁用 Wordpress 首页上的插件,以使其更轻一些。我只想在显示首页时禁用它。 我在 wp-content/mu-plugins/中放置了这个工作代码它会禁用除指定/子页面/之外的所有页
有没有一种方法可以使首页包含 2 个 View ,而不使用 Drupal 6.x 中的面板模块? 谢谢 最佳答案 如果您不想使用面板,您可以将 2 个 View 创建为 block (就像侧边栏等一样
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
我尝试管理基于 Plone 的网站 www.capital-tennis.org 上的内容。我对 Plone 本身几乎一无所知。 我想向网站的首页(主页面)添加 2 个 portlet,一个在左侧(在
如图所示,底部有 3 个 Controller ,分别是(HomeTableViewController、NavigationViewController 和 NewsViewController)
我开始在Windows上使用pentaho BI Server 5.2,并尝试通过本教程使用mysql配置进行安装: https://anonymousbi.wordpress.com/2013/12
我的首页(也就是发布帖子的页面)上的链接是红色的,悬停时它们会变成白色。但是在我的 STATIC 页面上,我希望链接在悬停时为白色和红色,我该怎么做? Tumblr 允许将 html 添加到您的静态页
我想创建一个网站 ala failblog.org,用户可以在其中提交内容并对内容进行投票 我想做的是 一种。向节点/文章添加一个字段,称为“front_page_at (date_time)” 湾。
注意:不能使用 Javascript 或 iframe。事实上,我不能相信客户端浏览器可以做任何事情,除了最基本的事情。 我正在将遗留的 PHP4 应用程序重建为 MVC 应用程序,目前我的大部分研究
我在这里不知所措。我觉得我已经尝试了所有的方法,并使用了其他帖子/教程中解释的确切方法。我知道您需要使用光标并设置第一个和最后一个可见文档,以便在向前移动的情况下从最后一个文档开始,在向后移动的情况下
我是一名优秀的程序员,十分优秀!