I'm learning about multi-pane apps and am running the Master/Detail Flow application that gets set up by Android Studio when you create a new project (and select this option). According to the comments within the Google code that gets created, the app should display in multi-pane mode for devices with large-screen layouts. The problem that I am having is that no matter what AVD I use, I only get a single pane. First, here is the onCreate method of the main activity. Please note that this code comes straight from Google (it isn't my code):
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item_list);
if (findViewById(R.id.item_detail_container) != null) {
// The detail container view will be present only in the
// large-screen layouts (res/values-large and
// res/values-sw600dp). If this view is present, then the
// activity should be in two-pane mode.
mTwoPane = true;
// In two-pane mode, list items should be given the
// 'activated' state when touched.
((ItemListFragment) getFragmentManager()
.findFragmentById(R.id.item_list))
.setActivateOnItemClick(true);
}
// TODO: If exposing deep links into your app, handle intents here.
}
According to the Android Developer docs, running this code on a device with dp of at least 640dp x 480dp is large enough to qualify as a large screen, and presumably will then render in multi-pane mode. I'm using an AVD to model the Nexus 10 API 19 device, which has 800dp x 1280: xhdpi. Here is more information:
Here is what I get when I run this. Clearly not displaying multiple panes: What do I need to do to get this to show multiple panes? When I run this on a USB-connected device, it works perfectly, so the code is accurate. The issue must be the AVD that I am using? Thanks!
I had the same problem : edit your AVD, go to advanced settings, then select no skin in the "Custom skin definition" combo box.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With