简体   繁体   中英

How to use fragments with LinearLayout

I'm doing a Android App and I'm having problem when I use LinearLayout in my FragmentActivity with some fragments.

In the XML of my FragmentActivity I'm using LinearLayout with vertical orientation. On the onCreate method I add 3 fragments on this activity. But it show only the first fragment.

If I change LinearLayout to FrameLayout all the fragments are show overlapping each other

@Daniel Gabay is right. The problem was caused because I was using the wrong value for android:layout_width,android:layout_height

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM