第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法使用導航故事板在片段中添加按鈕以從一個片段跳轉(zhuǎn)到另一個片段

無法使用導航故事板在片段中添加按鈕以從一個片段跳轉(zhuǎn)到另一個片段

阿晨1998 2021-06-18 18:51:01
我正在嘗試使用android studio的導航故事板的方法在片段頁面中添加一個按鈕以從一個片段跳轉(zhuǎn)到另一個片段。但是,在 Mainfragment.java 中,我的按鈕 id 無法解析,它無法識別我的按鈕 id,我不知道為什么。請幫忙!  public MainFragment() {        // Required empty public constructor    }    @Override    public View onCreateView(LayoutInflater inflater, ViewGroup container,                             Bundle savedInstanceState) {        // Inflate the layout for this fragment        return inflater.inflate(R.layout.fragment_main, container, false);    }    @Override    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {        super.onViewCreated(view, savedInstanceState);        Button goToBtn = (Button) this.findViewById(R.id.goToBtn);        goToBtn.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.toAccount, null));    }    }對于 中的上述代碼Mainfragment.java,findViewById是紅色的。
查看完整描述

1 回答

?
溫溫醬

TA貢獻1752條經(jīng)驗 獲得超4個贊

改變線下

Button goToBtn = (Button) this.findViewById(R.id.goToBtn);

Button goToBtn = (Button) view.findViewById(R.id.goToBtn);


查看完整回答
反對 回復 2021-06-30
  • 1 回答
  • 0 關注
  • 137 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號