当前位置: 首页>>代码示例>>Java>>正文


Java PopupWindow.setContentView方法代码示例

本文整理汇总了Java中android.widget.PopupWindow.setContentView方法的典型用法代码示例。如果您正苦于以下问题:Java PopupWindow.setContentView方法的具体用法?Java PopupWindow.setContentView怎么用?Java PopupWindow.setContentView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.PopupWindow的用法示例。


在下文中一共展示了PopupWindow.setContentView方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import android.widget.PopupWindow; //导入方法依赖的package包/类
public static PopupWindow create(@NonNull Context context, @NonNull BubbleLayout bubbleLayout) {

        PopupWindow popupWindow = new PopupWindow(context);

        popupWindow.setContentView(bubbleLayout);
        popupWindow.setOutsideTouchable(true);
        popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
        popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        popupWindow.setAnimationStyle(android.R.style.Animation_Dialog);
        // change background color to transparent
        Drawable drawable;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            drawable = context.getDrawable(R.drawable.popup_window_transparent);
        } else {
            drawable = context.getResources().getDrawable(R.drawable.popup_window_transparent);
        }
        popupWindow.setBackgroundDrawable(drawable);

        return popupWindow;
    }
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:21,代码来源:BubblePopupHelper.java

示例2: ListFilePopWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
public ListFilePopWindow(Context context, View targetView) {
    super();
    this.targetView = targetView;
    View contentView = LayoutInflater.from(context).inflate(R.layout.kf5_list_file_dir, null);
    listView = (ListView) contentView.findViewById(R.id.kf5_list_dir);
    Point point = ScreenUtils.getScreenSize(context);
    int height = (int) (point.y * (4.5f / 8.0f));
    popupWindow = new PopupWindow();
    popupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    popupWindow.setHeight(height);
    popupWindow.setBackgroundDrawable(new BitmapDrawable());
    popupWindow.setOutsideTouchable(true);
    popupWindow.setFocusable(true);
    popupWindow.setTouchable(true);
    popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {

        @Override
        public void onDismiss() {
            // TODO Auto-generated method stub
            popupWindow.dismiss();
        }
    });
    popupWindow.setAnimationStyle(R.style.KF5FileListPopAnim);
    popupWindow.setContentView(contentView);
    listView.setOnItemClickListener(this);
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:27,代码来源:ListFilePopWindow.java

示例3: progressPopUp

import android.widget.PopupWindow; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void  progressPopUp(final Activity context,String data){
	
	RelativeLayout layoutId = (RelativeLayout)context.findViewById(R.id.dialog_rootView);
	LayoutInflater layoutInflater  = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	View layout = layoutInflater.inflate(R.layout.progresspopup, layoutId);
	txtWaiting = (TextView)layout.findViewById(R.id.txtWaiting);

	paymentAlert = new PopupWindow(context);
	paymentAlert.setContentView(layout);		
	paymentAlert.setHeight(WindowManager.LayoutParams.MATCH_PARENT);		
	paymentAlert.setWidth(WindowManager.LayoutParams.MATCH_PARENT);
	paymentAlert.setFocusable(true);		
	paymentAlert.setBackgroundDrawable(new BitmapDrawable());
	paymentAlert.showAtLocation(layout, Gravity.CENTER, 0, 0);	
	if(data !=null)
		txtWaiting.setText(data);
   }
 
开发者ID:mityung,项目名称:XERUNG,代码行数:19,代码来源:ProgressDialog.java

示例4: OverflowHelper

import android.widget.PopupWindow; //导入方法依赖的package包/类
public OverflowHelper(Context ctx) {
    mContext = ctx;
    mNormalColor = mContext.getResources().getColor(R.color.white);
    mDisabledColor = mContext.getResources().getColor(R.color.text_disabled);
    mPopupLayout = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.comm_popup_menu, null, true);
    mListView = (PopupMenuListView) mPopupLayout.findViewById(R.id.comm_popup_list);
    mAdapter = new OverflowAdapter(this, ctx);
    mListView.setAdapter(mAdapter);
    mListView.setOnKeyListener(mOnKeyListener);
    mPopupWindow = new PopupWindow(mPopupLayout, -2, -2, true);
    mPopupWindow.setContentView(mPopupLayout);
    mPopupWindow.setOutsideTouchable(true);
    mPopupWindow.setFocusable(true);
    mPopupWindow.setWidth(414);
    mPopupWindow.getContentView().setOnTouchListener(mOnTouchListener);
    mPopupWindow.update();
}
 
开发者ID:NewCasino,项目名称:browser,代码行数:18,代码来源:OverflowHelper.java

示例5: getMenuOptionPopup

import android.widget.PopupWindow; //导入方法依赖的package包/类
/** A popup to select the type of message to send, "Text", "Image", "Location".*/
public static PopupWindow getMenuOptionPopup(Context context, View.OnClickListener listener){
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View popupView = inflater.inflate(R.layout.chat_sdk_popup_options, null);
    PopupWindow optionPopup = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
    popupView.findViewById(R.id.chat_sdk_btn_choose_picture).setOnClickListener(listener);
    popupView.findViewById(R.id.chat_sdk_btn_take_picture).setOnClickListener(listener);
    popupView.findViewById(R.id.chat_sdk_btn_location).setOnClickListener(listener);

    if (!BDefines.Options.LocationEnabled || context.getString(R.string.google_maps_api_key).isEmpty()){
        popupView.findViewById(R.id.chat_sdk_btn_location).setVisibility(View.GONE);
    }
    
    popupView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);

    // TODO fix popup size to wrap view size.
    optionPopup.setContentView(popupView);
    optionPopup.setBackgroundDrawable(new BitmapDrawable());
    optionPopup.setOutsideTouchable(true);
    optionPopup.setWidth(popupView.getMeasuredWidth());
    optionPopup.setHeight(popupView.getMeasuredHeight());
    return optionPopup;
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:24,代码来源:DialogUtils.java

示例6: showPopUpWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void showPopUpWindow(View view) {
    WindowManager systemService = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
    int width = systemService.getDefaultDisplay().getWidth();
    int height = systemService.getDefaultDisplay().getHeight();
    int popWidth = (int) (width * 0.75);
    int popHeight = (int) (height * 0.64);
    PopupWindow popupWindow = new PopupWindow(this);
    popupWindow.setWidth(popWidth);
    popupWindow.setHeight(popHeight);
    View inflate = LayoutInflater.from(this).inflate(R.layout.ll_life_detail_pop,null);
    popupWindow.setContentView(inflate);
    popupWindow.setClippingEnabled(false);//设置覆盖状态栏,重点
    popupWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.rl_pop_top_corner));
    popupWindow.setOutsideTouchable(false);
    popupWindow.setFocusable(true);
    popupWindow.showAtLocation(view, Gravity.CENTER,0,0);

    initPopUpView(inflate);

}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:21,代码来源:LifeDetailActivity.java

示例7: CandidateView

import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
 * Construct a CandidateView for showing suggested words for completion.
 * @param context
 * @param attrs
 */
public CandidateView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mSelectionHighlight = context.getResources().getDrawable(
            R.drawable.list_selector_background_pressed);

    LayoutInflater inflate =
        (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    Resources res = context.getResources();
    mPreviewPopup = new PopupWindow(context);
    mPreviewText = (TextView) inflate.inflate(R.layout.candidate_preview, null);
    mPreviewPopup.setWindowLayoutMode(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    mPreviewPopup.setContentView(mPreviewText);
    mPreviewPopup.setBackgroundDrawable(null);
    mPreviewPopup.setAnimationStyle(R.style.KeyPreviewAnimation);
    mColorNormal = res.getColor(R.color.candidate_normal);
    mColorRecommended = res.getColor(R.color.candidate_recommended);
    mColorOther = res.getColor(R.color.candidate_other);
    mDivider = res.getDrawable(R.drawable.keyboard_suggest_strip_divider);
    mAddToDictionaryHint = res.getString(R.string.hint_add_to_dictionary);

    mPaint = new Paint();
    mPaint.setColor(mColorNormal);
    mPaint.setAntiAlias(true);
    mPaint.setTextSize(mPreviewText.getTextSize());
    mPaint.setStrokeWidth(0);
    mPaint.setTextAlign(Align.CENTER);
    mDescent = (int) mPaint.descent();
    mMinTouchableWidth = (int)res.getDimension(R.dimen.candidate_min_touchable_width);
    
    mGestureDetector = new GestureDetector(
            new CandidateStripGestureListener(mMinTouchableWidth));
    setWillNotDraw(false);
    setHorizontalScrollBarEnabled(false);
    setVerticalScrollBarEnabled(false);
    scrollTo(0, getScrollY());
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:43,代码来源:CandidateView.java

示例8: showShareLayout

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void showShareLayout() {
    mSharePopWindow = new PopupWindow(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    View view = LayoutInflater.from(this).inflate(R.layout.sharelayout, null);
    view.findViewById(R.id.btn_share_to_circle).setOnClickListener(this);
    view.findViewById(R.id.btn_share_to_friend).setOnClickListener(this);
    mSharePopWindow.setContentView(view);
    mSharePopWindow.setFocusable(false);
    mSharePopWindow.setBackgroundDrawable(new BitmapDrawable());
    mSharePopWindow.setOutsideTouchable(true);
    mSharePopWindow.showAtLocation(findViewById(android.R.id.content), Gravity.BOTTOM,0,0);
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:12,代码来源:MovementTrackActivity.java

示例9: showPop

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void showPop() {
        final PopupWindow popupWindow = new PopupWindow(this,null,R.style.bottomDialog);
        View view = LayoutInflater.from(this).inflate(R.layout.popup, null);
        popupWindow.setContentView(view);

        popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
        popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

        popupWindow.setOutsideTouchable(true);
        popupWindow.setTouchable(true);

//                popupWindow.setAnimationStyle(R.style.);

        popupWindow.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#88000000")));
//                popupWindow.showAsDropDown(mButton7, 0, -mButton7.getHeight());//在view下方

        //如果是0,0的话,默认是在这个view(anchor锚)的左下角作为起始点
        //Gravity.RIGHT代表在view的右下角开始 这个是api19开始支持


        //这种显示方式如果是和view无关,里面只是为了获得token
        popupWindow.showAtLocation(mButton7, Gravity.BOTTOM|Gravity.LEFT,100,200);
        //这个x y的位置是先计算重力所在的位置,然后再以那个位置为左上角,x,y是相对位置

        //如果是Gravity.BOTTOM   设置y值不能为负值
        //设置了重力后坐标系的方向就变了,如果是Gravity.BOTTOM 那么y轴的方向就是向上
    }
 
开发者ID:pop1234o,项目名称:BestPracticeApp,代码行数:28,代码来源:MainPopUpWindowActivity.java

示例10: init

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void init() {
    mCommandAdapter = new CommandListSuggestionsAdapter(getContext());
    mCommandAdapter.setClickListener(this);
    List<CommandAliasManager.CommandAlias> additionalItems = new ArrayList<>();
    additionalItems.add(CommandAliasManager.CommandAlias.raw("wait", "<seconds>", ""));
    additionalItems.add(CommandAliasManager.CommandAlias.raw("wait-for", "<channel>", ""));
    mCommandAdapter.setAdditionalItems(additionalItems);

    mSuggestionsList = new RecyclerView(getContext());
    mSuggestionsList.setAdapter(mCommandAdapter);
    mSuggestionsList.setLayoutManager(new LinearLayoutManager(getContext()));

    mPopupAnchor = new View(getContext());

    mPopupWindow = new PopupWindow(getContext(), null, android.R.attr.listPopupWindowStyle);
    mPopupWindow.setContentView(mSuggestionsList);
    mPopupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
    mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);

    mPopupItemHeight = StyledAttributesHelper.getDimensionPixelSize(getContext(),
            android.R.attr.listPreferredItemHeightSmall, 0);
    mMaxPopupHeight = getResources().getDimensionPixelSize(R.dimen.list_popup_max_height);

    addTextChangedListener(new SimpleTextWatcher((Editable s) -> {
        if (enoughToFilter())
            performFiltering(false);
        else
            dismissDropDown();
    }));
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:31,代码来源:AutoRunCommandListEditText.java

示例11: init

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void init(Context context) {
    LayoutInflater inflater = LayoutInflater.from(context);
    mPopupView = inflater.inflate(R.layout.summary_popup, null);
    mSummaryContent = (TextView) mPopupView.findViewById(R.id.text);
    mTriangleImg = (ImageView) mPopupView.findViewById(R.id.indicate);
    mPopupWindow = new PopupWindow(mPopupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    mPopupWindow.setContentView(mPopupView);
    this.setLocation(new int[]{0, 0});
}
 
开发者ID:hejunlin2013,项目名称:EpisodeListView,代码行数:10,代码来源:SummaryPopupWindow.java

示例12: getPopupWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
 * 生成并设置PopupWindow对话框
 *
 * @param view
 * @return
 */
private PopupWindow getPopupWindow(View view) {
    PopupWindow popupWindow = new PopupWindow(mContext);
    popupWindow.setContentView(view);
    popupWindow.setWidth(WindowManager.LayoutParams.MATCH_PARENT);
    popupWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
    popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
    popupWindow.setFocusable(true);
    popupWindow.setOutsideTouchable(true);
    return popupWindow;
}
 
开发者ID:codekongs,项目名称:ImageClassify,代码行数:17,代码来源:ModifyUserInfoPresenter.java

示例13: init

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void init() {
    setupColors();
    setupList();
    mSearchEditText.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    mStartSearchImageView.setOnClickListener(this);
    mDoneSearchImageView.setOnClickListener(this);
    mSearchEditText.addTextChangedListener(mTextWatcher);

    mPopupWindow = new PopupWindow(mContext);
    mPopupWindow.setContentView(mSpinnerListContainer);
    mPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
    mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
    mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            hideEdit();
        }
    });
    mPopupWindow.setFocusable(false);
    mPopupWindow.setElevation(DefaultElevation);
    mPopupWindow.setBackgroundDrawable(ContextCompat.getDrawable(mContext, R.drawable.spinner_drawable));

    mSpinnerListView.setOnItemClickListener(mOnItemSelectedListener);
    if (mCurrSelectedView == null) {
        if (!TextUtils.isEmpty(mSearchHintText)) {
            mSearchEditText.setHint(mSearchHintText);
        }
        if (!TextUtils.isEmpty(mNoItemsFoundText)) {
            mEmptyTextView.setText(mNoItemsFoundText);
        }
        if (mCurrSelectedView == null && !TextUtils.isEmpty(mRevealEmptyText)) {
            TextView textView = new TextView(mContext);
            textView.setText(mRevealEmptyText);
            mCurrSelectedView = new SelectedView(textView, -1, 0);
            mRevealItem.addView(textView);
        }
    } else {
        mSpinnerListView.performItemClick(mCurrSelectedView.getView(), mCurrSelectedView.getPosition(), mCurrSelectedView.getId());
    }
    clearAnimation();
    clearFocus();
}
 
开发者ID:michaelprimez,项目名称:searchablespinner,代码行数:43,代码来源:SearchableSpinner.java

示例14: showLongPressEmojiTip

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void showLongPressEmojiTip() {
    PopupWindow popupWindow = new PopupWindow(getContext());
    popupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
    popupWindow.setContentView(LayoutInflater.from(getContext()).inflate(R.layout.layout_bubble, null));
    popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    popupWindow.setOutsideTouchable(true);
    popupWindow.showAsDropDown(mTextInputEditText, 0, 30, Gravity.CENTER_HORIZONTAL);
}
 
开发者ID:auv1107,项目名称:TextEmoji,代码行数:10,代码来源:EmojiFragment.java


注:本文中的android.widget.PopupWindow.setContentView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。