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

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

在android Java中實(shí)現(xiàn)底部抽屜

在android Java中實(shí)現(xiàn)底部抽屜

瀟瀟雨雨 2023-07-28 10:03:49
我無法在 android (java) 中實(shí)現(xiàn)底部抽屜,也找不到任何有關(guān)其使用的工作示例/教程。您能編寫使用底部抽屜的示例代碼嗎?或者,我嘗試使用下拉菜單,但我的應(yīng)用程序只需要一個(gè)底部抽屜<com.google.android.material.bottomnavigation.BottomNavigationView ????????android:id="@+id/navbottom" ????????android:layout_width="match_parent" ????????android:layout_height="64dp" ????????android:layout_gravity="bottom" ????????app:menu="@menu/menu_nav">????</com.google.android.material.bottomnavigation.BottomNavigationView>```這是我的底部導(dǎo)航視圖的代碼它應(yīng)該是這樣的1
查看完整描述

1 回答

?
ibeautiful

TA貢獻(xiàn)1993條經(jīng)驗(yàn) 獲得超6個(gè)贊

在您添加的屏幕截圖中,我看到了類似 BottomSheet 的內(nèi)容。為了獲得這種對話框的外觀,您可能想要使用,BottomSheetDialogFragment所以下面我將解釋如何在您的活動(dòng)中實(shí)現(xiàn)它。


1) 首先,您需要?jiǎng)?chuàng)建一個(gè)類,該類將從BottomSheetDialogFragment該片段將使用的布局?jǐn)U展并擴(kuò)充該布局。


public class ExampleBottomSheetDialog extends BottomSheetDialogFragment {


? ? @Override

? ? public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle?

savedInstanceState) {

? ? ? ? return inflater.inflate(*R.layout.bottom_sheet_layout*, container, false);

? ? }

}

2)然后您需要?jiǎng)?chuàng)建*R.layout.bottom_sheet_layout*布局文件來保存所需的視圖并在需要時(shí)為其提供邏輯。


3) 之后,您可以通過編程方式設(shè)置Dialog邏輯。例如,您可以通過按 按鈕打開此對話框。


Button buttonDialogBottomSheet = findViewById(R.id.btn_sh_dialog);

buttonDialogBottomSheet.setOnClickListener((v) -> {

? ? ExampleBottomSheetDialog bottomSheetDialog = new ExampleBottomSheetDialog();

? ? bottomSheetDialog.show(getSupportFragmentManager(), "simple tag");

});

查看完整回答
反對 回復(fù) 2023-07-28
  • 1 回答
  • 0 關(guān)注
  • 164 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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