* 更多标签显示
*/
private void showPopupWindow() {
View contentView = getLayoutInflater().inflate(R.layout.popup_layout_fwsd_flags, null);
popupWindow = new PopupWindow(contentView, LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT, true);
popupWindow.setOutsideTouchable(true);
popupWindow.setAnimationStyle(R.style.add_new_style);// 出入动画
popupWindow.setTouchInterceptor(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Log.i("mengdd", "onTouch : ");
// 这里如果返回true的话,touch事件将被拦截
// 拦截后 PopupWindow的onTouchEvent不被调用,这样点击外部区域无法dismiss
return false;
}
});
ColorDrawable cd = new ColorDrawable(-0000);
popupWindow.setBackgroundDrawable(cd);
popupWindow.showAtLocation(findViewById(R.id.ll_sxd_school), Gravity.BOTTOM, 0, 0);
TextView tvDismiss = (TextView)contentView.findViewById(R.id.tv_popup_fwsd_flags_dismiss);
ListView lvPopup = (ListView)contentView.findViewById(R.id.lv_popup_fwsd_flags);
popupFlagsAdapter = new PopupFlagsAdapter(context, listFlag);
lvPopup.setAdapter(popupFlagsAdapter);
lvPopup.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long id) {
popupWindow.dismiss();
Intent intent = new Intent(SXDSchoolActivity.this,SXDSchoolHDActivity.class);
intent.putExtra("bean",popupFlagsAdapter.getItem(position));
intent.putExtra("pg_Id",pioneers_Group.getPg_Id()+"");//groupid
startActivity(intent);
}
});
tvDismiss.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
popupWindow.dismiss();
}
});
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~anim
//----add_new_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="300"
android:fromYDelta="100%p"
android:toYDelta="0" />
<alpha
android:duration="300"
android:fromAlpha="0.0"
android:toAlpha="1.0" />
</set>
//----------------add_new_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="300"
android:fromYDelta="0"
android:toYDelta="50%p" />
<alpha
android:duration="300"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>
//~~~~~~~~~~~~~~~~~~~~values
<style name="add_new_style">
<item name="android:windowEnterAnimation">@anim/add_new_in</item>
<item name="android:windowExitAnimation">@anim/add_new_out</item>
</style>