- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试用 fragment View 替换frame_layout
的内容。我过去只使用 transaction.replace
来做到这一点,但它只是将 View 放在主要内容的顶部。
这是代码:
这就是我替换 ID 为 contains 的 frame_layout
的地方:
VideosFragment videosFragment = new VideosFragment();
Bundle bundle = new Bundle();
bundle.putCharSequence("Character", view.getContentDescription());
videosFragment.setArguments(bundle);
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.replace(R.id.contain , videosFragment).addToBackStack(null).commit();
这是 main_Activity 的 xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.shobakyDC.muchannel.MainActivity">
<FrameLayout
android:id ="@+id/contain"
android:layout_width="match_parent"
android:background="@drawable/islamic_green"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/progressBar2"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<GridView
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:horizontalSpacing="10dp"
android:numColumns="2"
android:paddingStart="50dp"
android:paddingTop="10dp"
android:verticalSpacing="10dp"
android:paddingRight="0dp"
android:paddingLeft="50dp"
android:paddingEnd="0dp">
</GridView>
</FrameLayout>
<android.support.design.widget.NavigationView
android:id="@+id/Navigator"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:headerLayout="@layout/header"
android:layout_gravity="start"
android:background="@android:color/white"
app:itemTextColor="@color/navcolor"
app:itemIconTint="@color/navcolor"
app:menu="@menu/navigationmenu">
</android.support.design.widget.NavigationView>
视频 fragment :
public class VideosFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.videofragment_layout , container , false);
Bundle args = getArguments();
TextView textView = view.findViewById(R.id.textView);
textView.setText(args.getString("Character"));
return view;
}
}
最佳答案
在 Main Activity 的 xml 中,您必须创建一个空的 FrameLayout,其 ID 如下所示:
<FrameLayout
android:id ="@+id/contain"
android:layout_width="match_parent"
android:background="@drawable/islamic_green"
android:layout_height="match_parent">
</FrameLayout>
然后为这个 fragment 制作一个单独的xml布局。现在您必须在主 Activity 中将此 fragment 布局替换为框架布局。
关于java - 我无法使用 transaction.replace,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49152443/
我不明白注释之间的实际区别是什么javax.transaction.Transactional和org.springframework.transaction.annotation.Transacti
我不明白注释 javax.transaction.Transactional 和 org.springframework.transaction.annotation.Transactional 之间
我正在尝试删除一个节点。 我知道要先删除节点,我必须删除关系。 MATCH (n:`Dummy`) WHERE n.uuid='1aa41234-aaaa-xxxx-ffff-xxxx11xx0x62
假设我有一个共享钱包,可以为我和我的兄弟收集以太币。我们彼此分享这个钱包的 50%。 如果有一笔 ETH 交易进入这个钱包,是否有一种自动方式可以将收到的以太币自动发送到我的个人钱包和我兄弟的钱包,而
我已经阅读并重新阅读了文档 re: mnesia:activity/3、mnesia:activity/4 和 mnesia/transaction/2,但它们对我来说仍然像是一种晦涩难懂的外语。 在
精简版: 在 Firebase 事务(在 Java 中)中,如果我从 MutableData.getValue() 中得到意外的或不一致的(陈旧的)值,我应该如何进行错误检查并确保事务在必要时重复运行
使用 Spring 时@Transcational在服务层,我需要放置 在 xml 文件上。 我想知道 可以javax.jdo.annotations.Transactional像spring一样用在
这是我的情况。 我正在构建一个 RESTful Web 服务,从客户端接收数据,然后根据该数据创建一个事件,然后我想将这个新事件推送到 celery 以异步处理它。 我使用 Pyramid 构建 RE
这是我的情况。 我正在构建一个 RESTful web 服务,它从客户端接收数据,然后从该数据创建一个事件,然后我想将这个新事件推送到 celery 以异步处理它。 我使用 pyramid 构建 RE
当我启动 jetty 时,以下行出现在日志中: :INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp
@Transactional(rollbackFor = someException.class) public void methodA() throws someException { t
我花了几个小时试图解决这个问题。谷歌和 Stackoverflow 也没有多大帮助。所以这里非常欢迎任何建议。 我正在尝试在更新两个相关表时对事务应用回滚逻辑: 一般的代码是: // ... $em
我在 Service 类中看到了一个方法,它被标记为 @Transactional,但它还在同一个类中调用了一些其他方法,这些方法没有被标记为 @Transactional。 这是否意味着对单独方法的
我目前正在使用 Microsoft Enterprise Library 5.0,我想知道下面的代码是否是处理事务的可接受方式。 我已经稍微简化了场景,但本质是我想在同一个事务中在不同的数据库中执行多
我已将以下服务方法注释为事务性: /* (non-Javadoc) * @see a.b.service.CustomerService#activateCustomer(a.b.m
以下是我的代码的一个代表性片段,其中在 transaction.Rollback() 处抛出了一个意外的异常,至少对我而言是这样。声明。 异常(exception)是类型 NHibernate.Tra
我试过将 COMMIT TRAN 放在 if else 循环中,但我仍然收到此错误。 我必须为一个类(class)招收一名学生。如果注册后的座位数为负数,我必须将其反转并打印一条消息说不能注册。我已经
我已经实现了一个具有事务的路由。当用户通过单击“后退”按钮移出这条路线时,我希望用户能够确认退出并丢失通过回滚事务所做的任何更改。 问题是,如果用户返回路由,Ember Data 会引发错误并指出:
当我从另一个事务方法调用一个事务方法时会发生什么,现在我的第二个事务方法已完成,并且它返回到第一个事务方法,不幸的是它失败了,所以它会回滚所有内容,意味着它会回滚第二个事务方法吗?交易方式改变..??
这个问题在这里已经有了答案: @Transactional method called from another method doesn't obtain a transaction (4 个回答)
我是一名优秀的程序员,十分优秀!