<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fragment &#8211; WANGXUCHAO.CN</title>
	<atom:link href="https://www.wangxuchao.cn/tag/fragment/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wangxuchao.cn</link>
	<description></description>
	<lastBuildDate>Sat, 18 Jan 2020 07:04:33 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
	<item>
		<title>记录一下Fragment连续跳转2次返回首页时第三个页面还显示的问题</title>
		<link>https://www.wangxuchao.cn/%e8%ae%b0%e5%bd%95%e4%b8%80%e4%b8%8bfragment%e8%bf%9e%e7%bb%ad%e8%b7%b3%e8%bd%ac2%e6%ac%a1%e8%bf%94%e5%9b%9e%e9%a6%96%e9%a1%b5%e6%97%b6%e7%ac%ac%e4%b8%89%e4%b8%aa%e9%a1%b5%e9%9d%a2%e8%bf%98%e6%98%be/</link>
		
		<dc:creator><![CDATA[wangxuchao]]></dc:creator>
		<pubDate>Mon, 06 Jan 2020 14:49:38 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Fragment]]></category>
		<guid isPermaLink="false">https://www.wangxuchao.cn/?p=105</guid>

					<description><![CDATA[有个需求是 “ A页面 ”跳转“ B页面 ”然后跳转“ C页面 ”。 在使用Fragment进行页面跳转的时候 &#8230; <p class="link-more"><a href="https://www.wangxuchao.cn/%e8%ae%b0%e5%bd%95%e4%b8%80%e4%b8%8bfragment%e8%bf%9e%e7%bb%ad%e8%b7%b3%e8%bd%ac2%e6%ac%a1%e8%bf%94%e5%9b%9e%e9%a6%96%e9%a1%b5%e6%97%b6%e7%ac%ac%e4%b8%89%e4%b8%aa%e9%a1%b5%e9%9d%a2%e8%bf%98%e6%98%be/" class="more-link">继续阅读<span class="screen-reader-text">“记录一下Fragment连续跳转2次返回首页时第三个页面还显示的问题”</span></a></p>]]></description>
										<content:encoded><![CDATA[
<p>有个需求是 “ A页面 ”跳转“ B页面 ”然后跳转“ C页面 ”。</p>



<p>在使用Fragment进行页面跳转的时候，第一次跳转（A-&gt;B）加.addToBackStack(null) ，第二次跳转（B-&gt;C）不加，然后点击返回按钮</p>



<p>期望状态是B、C消失，A出现</p>



<p>可是最终效果是返回到了A页面同时C页面还在，并没有被destroy，当进入另一个界面返回到A，这时候C会重新生成</p>



<p><strong>原因：</strong>点击返回键只回滚了第一次跳转（<strong>A</strong>-&gt;<strong>B</strong>）加.addToBackStack(null) ，C页面没有影响，也不会重新生成。A重新跳转到其他页面变成（<strong>A、C</strong>-&gt;<strong>B</strong>） 加.addToBackStack(null) ,返回的时候会回滚A、C两个页面的状态</p>



<p><strong>解决方案：</strong>（<strong>B</strong>-&gt;<strong>C</strong>）加.addToBackStack(null)  </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
