2016-02-10 81 views
0

enter image description here在抽屜式導航欄項目點擊彈出窗口

我想開發一個導航抽屜,onNavItemClick我想以顯示連接至particullar導航項目(NAV抽屜必須保持打開狀態) 一個彈出窗口,如果有人已經實現了這個請提供一個鏈接。

這是我的代碼片段。

@Override 
public void onNavigationDrawerItemSelected(int position) { 

    switch(position) 
    { 

     case 0: 
      mTitle = getString(R.string.history); 
      fragment_ride_history = new ListView(this); 
      popupWindow = new PopupWindow(
        fragment_ride_history, 
        ViewGroup.LayoutParams.WRAP_CONTENT, 
        ViewGroup.LayoutParams.WRAP_CONTENT); 
      popupWindow.setOutsideTouchable(true); 
      popupWindow.setFocusable(true); 
     popupWindow.setBackgroundDrawable(newBitmapDrawable()); 
      popupWindow.showAtLocation(new LinearLayout(this), Gravity.END, 10, 10); 
      popupWindow.update(50, 50, 1500, 900); 
      popupWindow.setContentView(fragment_ride_history); 
      // this is to call webservice and append the data on listview 
      getData(1); 
      fragment_ride_history.setOnScrollListener(new 
      break; 
    } 
} 
+0

popupWindow.showAsDropDown(anchorview,0,0,Gravity.RIGHT); – justDroid

+0

有點。我正在查找顯示在我的圖像鏈接中的視圖。 –

回答

0

有「onNavigationDrawerItemSelected」

我覺得「setBackgroundDrawable」的問題,因爲我的代碼工作,我只是刪除setBackgroundDrawable 和我說

fragment_ride_history.setBackgroundColor 
上顯示「popupWindow」沒問題

如果首先沒有通過調用webservice測試

for webservice嘗試從AsyncT調用它詢問或者你可以使用volley lib並顯示popupwindow來響應調用以不顯示空的listview。

+0

是的,這只是爲了顯示彈出式窗口,但我正在尋找在我的圖像link.thnx –

+0

你需要不關閉navigationDrawer並更新 popupWindow.showAtLocation(新LinearLayout(this),重力。 END,10,10); popupWindow.update(50,50,1500,900);將新的LinearLayout(this)移除到DrawerLayout並更新x,y,height的值 – Sally

+0

是的,它應該附加到抽屜項目(如可展開視圖中)。 –