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

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

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

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

阿晨1998 2021-06-18 18:51:01
我正在嘗試使用android studio的導(dǎo)航故事板的方法在片段頁面中添加一個(gè)按鈕以從一個(gè)片段跳轉(zhuǎn)到另一個(gè)片段。但是,在 Mainfragment.java 中,我的按鈕 id 無法解析,它無法識(shí)別我的按鈕 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貢獻(xiàn)1752條經(jīng)驗(yàn) 獲得超4個(gè)贊

改變線下

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

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


查看完整回答
反對 回復(fù) 2021-06-30
  • 1 回答
  • 0 關(guān)注
  • 150 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)