我刚吃完一看主/详细流程模板,我不2的事情了。
I've just taken a look at the Master/Detail Flow template and I can't figure 2 things out.
1)为什么它需要Android版11当C它所产生的$ C $似乎使用的片段兼容性支持?特别是,你为什么不能产生径流Android版本8的模板? (例如,该进口)
1) Why does it require Android version 11 when the code it generates seems to use the Fragment compatibility support? In particular, why can't you generate templates that run off Android version 8? (e.g. this import)
import android.support.v4.app.FragmentActivity;
2)如何主要活动知道是否显示在新的活动或者在细节的详细信息窗格中,如果它足够大?看来通过这code做到这一点:
2) How does the main Activity know whether to show the details in a new Activity or in the details pane if it's big enough? It seems to do it via this code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item_list);
if (findViewById(R.id.item_detail_container) != null) {
mTwoPane = true;
((ItemListFragment) getSupportFragmentManager()
.findFragmentById(R.id.item_list))
.setActivateOnItemClick(true);
}
}
的setContentView(R.layout.activity_item_list);
设置布局到 ListFragment
这只是设置了自己的适配器但我看不出 findViewById(R.id.item_detail_container)!= NULL
永远不会返回true,因为它似乎从来没有被打开/充气。
setContentView(R.layout.activity_item_list);
sets the layout to a ListFragment
which just sets its own adapter but I can't see how findViewById(R.id.item_detail_container) != null
will ever return true since it never seems to be opened/inflated.
任何线索?
推荐答案
在热切,得到的答案是,因为这在值-大/ refs.xml
After much looking, the answer is because of this in values-large/refs.xml
<resources>
<item type="layout" name="activity_item_list">@layout/activity_item_twopane</item>
</resources>
它重定向为正常布局到一个更大的布局(双窗格版)其中, R.id.item_detail_container
定义的要求。
这是pretty的混淆。我不知道为什么他们不只是叫大布局一样的正常布局,但随后有不同的XML。
This is pretty obfuscated. I'm not sure why they didn't just call the large layout the same as the normal layout but then have different xml.
相关推荐
最新文章