1

大家好..我想在我的碎片中添加两个布局。在第一个布局按钮单击时第二个布局膨胀后,一个布局已经膨胀...好吧,我尝试在第一个布局按钮的按钮单击时删除第一个布局并膨胀第二个布局但是我的按钮点击没有反应任何类型的反应..请帮助我

  public static LinearLayout mLL_MyNotes,mLin_myNotes,mLL_UploadNotes;
  public static ViewFlipper mVF_MyNotes,mViewUploadMyNotes;
  public static View mViewMyNotes;

   @Override
     public View onCreateView(final LayoutInflater inflater, final ViewGroup container,    Bundle savedInstanceState) {

     TextView text = new TextView(getActivity());
     text.setGravity(Gravity.CENTER);
     text.setTextSize(20 * getResources().getDisplayMetrics().density);
     text.setPadding(20, 20, 20, 20);


    if(mContent.equalsIgnoreCase("My Notes")){

        mViewMyNotes = inflater.inflate(R.layout.activity_myspace_mynotes_list, container, false);

        mLin_myNotes=(LinearLayout)mViewMyNotes.findViewById(R.id.mainLin_MyNotes);

        mVF_MyNotes = (ViewFlipper) mViewMyNotes.findViewById(R.id.vf_MySpace_MyNotes);

        mbtn_Upload_MyNotes = (Button) mViewMyNotes.findViewById(R.id.btnUpload_MySpace_MyNotes);
        mWV_MyNotes = (WebView) mViewMyNotes.findViewById(R.id.wv_MySpace_MyNotes);

        mLV_MyNotes = (ListView) mViewMyNotes.findViewById(R.id.lv_MySpace_MyNotes);
        mLV_MyNotes.setAdapter(new MySpace_MyNotesAdapter(getActivity(),R.layout.activity_myspace_mynotes_listitem));

        mbtn_Upload_MyNotes.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
        LayoutInflater Newinflater = (LayoutInflater) getActivity().
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

          mViewUploadMyNotes==Newinflater.inflate(R.layout.activity_myspace_mynotes_uploades,null);          
                  mLL_UploadNotes = (LinearLayout) mViewUploadMyNotes.findViewById(R.id.llUpload_MyNotes);

                ((ViewGroup) mLin_myNotes.getParent()).removeView(mViewUploadMyNotes);

                mLin_myNotes.addView(mViewUploadMyNotes);

            }
        });
        return mViewMyNotes;
4

0 回答 0