Fragment design: Adapting to multiple screen layouts by showing/hiding fragments within a single Activity?

前端 未结 4 2075
攒了一身酷
攒了一身酷 2020-12-13 00:08

I am trying to understand how to use Fragments to create apps that adapt well to multiple screens and layouts. I have studied a few examples:

  1. The Fragments doc
4条回答
  •  清歌不尽
    2020-12-13 00:49

    In this article http://developer.android.com/guide/practices/tablets-and-handsets.html#Fragments Google says:

    "The approach you choose depends on your design and personal preferences."

    and

    "Other times, however, dynamically swapping fragments for your handset design can make your code more complicated, because you must manage all the fragment combinations in the activity's code (rather than use alternative layout resources to define fragment combinations) and manage the back stack of fragments yourself (rather than allow the normal activity stack to handle back-navigation)."

提交回复
热议问题