首页 >> 严选问答 >

fragment生命周期的回调方法(fragment生命周期)

2024-01-09 23:50:15

问题描述:

fragment生命周期的回调方法(fragment生命周期),蹲一个有缘人,求别让我等空!

最佳答案

推荐答案

2024-01-09 23:50:15

您好,今日明帅来为大家解答以上的问题。fragment生命周期的回调方法,fragment生命周期相信很多小伙伴还不知道,现在让我们一起来看看吧!

1、测试代码[java] view plaincopypackage com.goso.testapp; import android.app.Activity; import android.app.ListFragment; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; /** * Demonstration of using ListFragment to show a list of items * from a canned array. */ public class FragmentListArray extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.e("HJJ", "Activity &&&& onCreate..."); // Create the list fragment and add it as our sole content. if (getFragmentManager().findFragmentById(android.R.id.content) == null) { ArrayListFragment list = new ArrayListFragment(); getFragmentManager().beginTransaction().add(android.R.id.content, list).commit(); } }。

本文就为大家分享到这里,希望小伙伴们会喜欢。

  免责声明:本答案或内容为用户上传,不代表本网观点。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。 如遇侵权请及时联系本站删除。

 
分享:
最新文章