List of usage examples for android.view Gravity TOP
int TOP
To view the source code for android.view Gravity TOP.
Click Source Link
From source file:com.licubeclub.zionhs.Notices_Parents.java
private void networkTask() { final Handler mHandler = new Handler(); new Thread() { public void run() { mHandler.post(new Runnable() { public void run() { SRL.setRefreshing(true); }//from ww w .j a v a2s .c o m }); //Task //Notices URL try { titlearray = new ArrayList<String>(); titleherfarray = new ArrayList<String>(); authorarray = new ArrayList<String>(); datearray = new ArrayList<String>(); Document doc = Jsoup.connect( "http://www.zion.hs.kr/main.php?menugrp=110100&master=bbs&act=list&master_sid=59") .get(); Elements rawdata = doc.select(".listbody a"); //Get contents from tags,"a" which are in the class,"listbody" Elements rawauthordata = doc.select("td:eq(3)"); //? ? - 3 td ? Elements rawdatedata = doc.select("td:eq(4)"); // ? - 4 td ? String titlestring = rawdata.toString(); Log.i("Notices", "Parsed Strings" + titlestring); for (Element el : rawdata) { String titlherfedata = el.attr("href"); String titledata = el.attr("title"); titleherfarray.add("http://www.zion.hs.kr/" + titlherfedata); // add value to ArrayList titlearray.add(titledata); // add value to ArrayList } Log.i("Notices", "Parsed Link Array Strings" + titleherfarray); Log.i("Notices", "Parsed Array Strings" + titlearray); for (Element el : rawauthordata) { String authordata = el.text(); Log.d("Author", el.text()); authorarray.add(authordata); } for (Element el : rawdatedata) { String datedata = el.text(); Log.d("Date", el.text()); datearray.add(datedata); } } catch (IOException e) { e.printStackTrace(); } mHandler.post(new Runnable() { public void run() { //UI Task adapter = new PostListAdapter(Notices_Parents.this, titlearray, datearray, authorarray); listview.setAdapter(adapter); listview.setOnItemClickListener(GoToWebPage); handler.sendEmptyMessage(0); SRL.setRefreshing(false); Toast toast = Toast.makeText(getApplicationContext(), getString(R.string.noti_parents_info), Toast.LENGTH_LONG); toast.setGravity(Gravity.TOP, 0, 0); toast.show(); } }); } }.start(); }
From source file:com.fibrobook.viewpager.custom.CardFragment.java
public void dayView(LinearLayout l) { LayoutParams params = new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT, Gravity.TOP); ListView eventList = new ListView(getActivity()); eventList.setLayoutParams(params);/* www.ja v a2 s . c o m*/ ArrayAdapter<DailyEvent> adapter = new ArrayAdapter<DailyEvent>(getActivity(), android.R.layout.simple_list_item_1, dailyEvents); eventList.setAdapter(adapter); eventList.setClickable(true); eventList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapter, View v, int position, long id) { ratingDialog = new Dialog(getActivity(), com.fibrobook.R.style.FullHeightDialog); ratingDialog.setContentView(com.fibrobook.R.layout.rating_dialog); ratingDialog.setCancelable(true); RatingBar ratingBar = (RatingBar) ratingDialog.findViewById(com.fibrobook.R.id.dialog_ratingbar); int i = 0; boolean exists = false; while (i < des.size()) { if (dailyEvents.get(position).getId() == des.get(i).getDailyEvent().getId()) { aes = des.get(i); ratingBar.setRating(aes.getIntensity()); exists = true; break; } i++; } if (!exists) aes = new DailyEventSummary(MainActivity.user, dailyEvents.get(position), MainActivity.date); Button updateButton = (Button) ratingDialog.findViewById(com.fibrobook.R.id.rank_dialog_button); updateButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RatingBar ratingBar = (RatingBar) ratingDialog .findViewById(com.fibrobook.R.id.dialog_ratingbar); aes.setIntensity(ratingBar.getRating()); DailyEventSummaryDAO dao = new DailyEventSummaryDAO(getActivity()); dao.save(aes); des = dao.getDailySummary(MainActivity.date); dao.close(); ratingDialog.dismiss(); } }); ratingDialog.show(); } }); l.addView(eventList); }
From source file:com.linkbubble.ui.BubbleFlowView.java
public void add(View view, boolean insertNextToCenterItem) { //view.setBackgroundColor(mViews.size() % 2 == 0 ? 0xff660066 : 0xff666600); view.setOnClickListener(mViewOnClickListener); view.setOnTouchListener(mViewOnTouchListener); int centerIndex = getCenterIndex(); int insertAtIndex = insertNextToCenterItem ? centerIndex + 1 : mViews.size(); if (view.getParent() != null) { ((ViewGroup) view.getParent()).removeView(view); }//from w w w. j av a2 s. c o m FrameLayout.LayoutParams lp = new LayoutParams(mItemWidth, mItemHeight, Gravity.TOP | Gravity.LEFT); lp.leftMargin = mEdgeMargin + insertAtIndex * mItemWidth; mContent.addView(view, lp); mContent.invalidate(); if (insertNextToCenterItem) { mViews.add(centerIndex + 1, view); } else { mViews.add(view); } updatePositions(); updateScales(getScrollX()); if (insertNextToCenterItem) { TranslateAnimation slideOnAnim = new TranslateAnimation(0, 0, -mItemHeight, 0); slideOnAnim.setDuration(Constant.BUBBLE_FLOW_ANIM_TIME); slideOnAnim.setFillAfter(true); view.startAnimation(slideOnAnim); for (int i = centerIndex + 2; i < mViews.size(); i++) { View viewToShift = mViews.get(i); TranslateAnimation slideRightAnim = new TranslateAnimation(-mItemWidth, 0, 0, 0); slideRightAnim.setDuration(Constant.BUBBLE_FLOW_ANIM_TIME); slideRightAnim.setFillAfter(true); viewToShift.startAnimation(slideRightAnim); } } ViewGroup.LayoutParams contentLP = mContent.getLayoutParams(); contentLP.width = (mViews.size() * mItemWidth) + mItemWidth + (2 * mEdgeMargin); mContent.setLayoutParams(contentLP); }
From source file:com.kyo.fitssystemwindows.FitsSystemWindowsFrameLayout.java
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final boolean applyInsets = lastInsets != null && ViewCompat.getFitsSystemWindows(this); final int layoutDirection = ViewCompat.getLayoutDirection(this); final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child.getVisibility() == GONE) { continue; }/*from w w w .j a va 2s. c o m*/ final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (lp.gravity == -1) { lp.gravity = DEFAULT_CHILD_GRAVITY; } if (applyInsets) { int cgrav = GravityCompat.getAbsoluteGravity(lp.gravity, layoutDirection); if (cgrav == -1) { cgrav = DEFAULT_CHILD_GRAVITY; } else { if ((cgrav & Gravity.VERTICAL_GRAVITY_MASK) == 0) { cgrav = cgrav | Gravity.TOP; } if ((cgrav & Gravity.HORIZONTAL_GRAVITY_MASK) == 0) { cgrav = cgrav | (layoutDirection == LAYOUT_DIRECTION_LTR ? Gravity.LEFT : Gravity.RIGHT); } } if (ViewCompat.getFitsSystemWindows(child)) { final int l = child.getPaddingLeft(); final int t = child.getPaddingTop(); final int r = child.getPaddingRight(); final int b = child.getPaddingBottom(); IMPL.dispatchChildInsets(child, lp, cgrav, lastInsets); child.setPadding(l, t, r, b); } else { IMPL.applyMarginInsets(lp, cgrav, lastInsets); lp.leftMargin += lp.leftMargin2; lp.topMargin += lp.topMargin2; lp.rightMargin += lp.rightMargin2; lp.bottomMargin += lp.bottomMargin2; } } } super.onMeasure(widthMeasureSpec, heightMeasureSpec); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child.getVisibility() == GONE || ViewCompat.getFitsSystemWindows(child)) { continue; } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); lp.leftMargin -= lp.leftMargin2; lp.topMargin -= lp.topMargin2; lp.rightMargin -= lp.rightMargin2; lp.bottomMargin -= lp.bottomMargin2; } }
From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.AppReferenceObj.java
public void render(final Context context, final ViewGroup frame, Obj obj, boolean allowInteractions) { JSONObject content = obj.getJson();//from w w w .j ava 2 s . c o m // TODO: hack to show object history in app feeds SignedObj appState = getAppStateForChildFeed(context, obj); if (appState != null) { mAppStateObj.render(context, frame, obj, allowInteractions); return; } else { String appName = content.optString(PACKAGE_NAME); if (appName.contains(".")) { // TODO: look up label. appName = appName.substring(appName.lastIndexOf(".") + 1); } String text = "Welcome to " + appName + "!"; TextView valueTV = new TextView(context); valueTV.setText(text); valueTV.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); valueTV.setGravity(Gravity.TOP | Gravity.LEFT); frame.addView(valueTV); } }
From source file:com.qs.qswlw.view.Mypager.UltraViewPagerIndicator.java
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (viewPager == null || viewPager.getAdapter() == null) return;/* w w w. j a v a 2s. c o m*/ final int count = ((UltraViewPagerAdapter) viewPager.getAdapter()).getRealCount(); if (count == 0) return; int longSize; int shortSize; int longPaddingBefore; int longPaddingAfter; int shortPaddingBefore; int shortPaddingAfter; if (orientation == UltraViewPager.Orientation.HORIZONTAL) { longSize = viewPager.getWidth(); shortSize = viewPager.getHeight(); longPaddingBefore = (int) (getItemWidth() + getPaddingLeft() + marginLeft); longPaddingAfter = getPaddingRight() + marginRight; shortPaddingBefore = (int) (getItemWidth() + getPaddingTop() + marginTop); shortPaddingAfter = (int) paintStroke.getStrokeWidth() + getPaddingBottom() + marginBottom; } else { longSize = viewPager.getHeight(); shortSize = viewPager.getWidth(); longPaddingBefore = (int) (getItemWidth() + getPaddingTop() + marginTop); longPaddingAfter = (int) paintStroke.getStrokeWidth() + getPaddingBottom() + marginBottom; shortPaddingBefore = (int) (getItemWidth() + getPaddingLeft() + marginLeft); shortPaddingAfter = getPaddingRight() + marginRight; } final float itemWidth = getItemWidth(); final int widthRatio = isDrawResIndicator() ? 1 : 2; //bitmap resource X1 : circle X2 if (indicatorPadding == 0) { indicatorPadding = (int) itemWidth; } float shortOffset = shortPaddingBefore; float longOffset = longPaddingBefore; final float indicatorLength = count * itemWidth * widthRatio + (count - 1) * indicatorPadding; final int horizontalGravityMask = gravity & Gravity.HORIZONTAL_GRAVITY_MASK; final int verticalGravityMask = gravity & Gravity.VERTICAL_GRAVITY_MASK; switch (horizontalGravityMask) { case Gravity.CENTER_HORIZONTAL: longOffset = (longSize - longPaddingBefore - longPaddingAfter - indicatorLength) / 2.0f; break; case Gravity.RIGHT: if (orientation == UltraViewPager.Orientation.HORIZONTAL) { longOffset = longSize - longPaddingAfter - indicatorLength; } if (orientation == UltraViewPager.Orientation.VERTICAL) { shortOffset = shortSize - shortPaddingAfter - itemWidth; } break; case Gravity.LEFT: default: break; } switch (verticalGravityMask) { case Gravity.CENTER_VERTICAL: shortOffset = (shortSize - shortPaddingAfter - shortPaddingBefore - itemWidth) / 2; break; case Gravity.BOTTOM: if (orientation == UltraViewPager.Orientation.HORIZONTAL) { shortOffset = shortSize - shortPaddingAfter - getItemHeight(); } if (orientation == UltraViewPager.Orientation.VERTICAL) { longOffset = longSize - longPaddingAfter - indicatorLength; } break; case Gravity.TOP: default: break; } if (horizontalGravityMask == Gravity.CENTER_HORIZONTAL && verticalGravityMask == Gravity.CENTER_VERTICAL) { shortOffset = (shortSize - shortPaddingAfter - shortPaddingBefore - itemWidth) / 2; } float dX; float dY; float pageFillRadius = radius; if (paintStroke.getStrokeWidth() > 0) { pageFillRadius -= paintStroke.getStrokeWidth() / 2.0f; //TODO may not/2 } //Draw stroked circles for (int iLoop = 0; iLoop < count; iLoop++) { float drawLong = longOffset + (iLoop * (itemWidth * widthRatio + indicatorPadding)); if (orientation == UltraViewPager.Orientation.HORIZONTAL) { dX = drawLong; dY = shortOffset; } else { dX = shortOffset; dY = drawLong; } if (isDrawResIndicator()) { if (iLoop == viewPager.getCurrentItem()) continue; canvas.drawBitmap(normalBitmap, dX, dY, paintFill); } else { // Only paint fill if not completely transparent if (paintFill.getAlpha() > 0) { paintFill.setColor(normalColor); canvas.drawCircle(dX, dY, pageFillRadius, paintFill); } // Only paint stroke if a stroke width was non-zero if (pageFillRadius != radius) { canvas.drawCircle(dX, dY, radius, paintStroke); } } } //Draw the filled circle according to the current scroll float cx = (viewPager.getCurrentItem()) * (itemWidth * widthRatio + indicatorPadding); if (animateIndicator) cx += pageOffset * itemWidth; if (orientation == UltraViewPager.Orientation.HORIZONTAL) { dX = longOffset + cx; dY = shortOffset; } else { dX = shortOffset; dY = longOffset + cx; } if (isDrawResIndicator()) { canvas.drawBitmap(focusBitmap, dX, dY, paintStroke); } else { paintFill.setColor(focusColor); canvas.drawCircle(dX, dY, radius, paintFill); } }
From source file:com.inductivebiblestudyapp.ui.dialogs.SimpleTooltipDialog.java
/** Adjusts the location of the dialog and positions the arrow. * //from w ww. j ava 2 s . c o m * @param dialog The dialog * @param rootView The rootView of the dialog * @param anchorLocation An X =0, Y=1 array of the anchor location via getLocationOnScreen. * @param anchorDimens An X =0, Y=1 array of anchor size in pixels * @param centered Whether to center the dialog or not. */ protected void adjustView(Dialog dialog, View rootView, int[] anchorLocation, int[] anchorDimens, boolean centered) { final int X_INDEX = 0; final int Y_INDEX = 1; try { int[] screenSize = new int[2]; getScreenDimens(screenSize); rootView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); final int rootWidth = rootView.getMeasuredWidth(); final int rootHeight = rootView.getMeasuredHeight(); final int[] screenCenter = new int[] { screenSize[X_INDEX] / 2, screenSize[Y_INDEX] / 2 }; //we have not displayed it yet, so we cannot measure location. //Instead, we will estimate based on Gravity.CENTER x and y final int[] estRootLocation = new int[] { screenCenter[X_INDEX] - rootWidth / 2, screenCenter[Y_INDEX] - rootHeight / 2 }; //if not left, right final boolean anchorToLeft = screenCenter[X_INDEX] >= anchorLocation[X_INDEX]; //if not top, bottom final boolean anchorToTop = screenCenter[Y_INDEX] >= anchorLocation[Y_INDEX]; WindowManager.LayoutParams wmlp = dialog.getWindow().getAttributes(); // lets start by calculating our midpoint //the horizontal center of the anchor relative to left side of screen final int anchorMidpointX = anchorLocation[X_INDEX] + anchorDimens[X_INDEX] / 2; //were the arrow margin should go. int arrowMarginLeft = 0; if (centered) { wmlp.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL; arrowMarginLeft = anchorMidpointX - estRootLocation[X_INDEX]; } else { //LEFT required if manually positioning. wmlp.gravity = Gravity.TOP | Gravity.LEFT; //center our dialog under our anchor as best as possible int dialogPosFromLeft = anchorMidpointX - rootWidth / 2; //check our values are sane. if (dialogPosFromLeft + rootWidth >= screenSize[X_INDEX]) { dialogPosFromLeft = screenSize[X_INDEX] - rootWidth; } else if (dialogPosFromLeft <= 0) { dialogPosFromLeft = 1; } wmlp.x = dialogPosFromLeft; arrowMarginLeft = anchorMidpointX - dialogPosFromLeft; } //horizontal positions are now calculated, now let's align our dialog vertically to be directly above our view. //the position from the top of the screen, to place the dialog. int desiredPosFromTop = 0; //the arrow params LinearLayout.LayoutParams arrowParams = null; if (anchorToTop) { //position ourself above. desiredPosFromTop = anchorLocation[Y_INDEX] + anchorDimens[Y_INDEX] - getStatusBarHeight(); mDownArrow.setVisibility(View.GONE); arrowParams = (LinearLayout.LayoutParams) mUpArrow.getLayoutParams(); } else { desiredPosFromTop = anchorLocation[Y_INDEX] - rootHeight - getStatusBarHeight(); mUpArrow.setVisibility(View.GONE); arrowParams = (LinearLayout.LayoutParams) mDownArrow.getLayoutParams(); } arrowParams.leftMargin = arrowMarginLeft; if (desiredPosFromTop >= screenSize[Y_INDEX]) { wmlp.y = screenSize[Y_INDEX] - 1; } else if (desiredPosFromTop <= 0) { wmlp.y = 1; } else { wmlp.y = desiredPosFromTop; } dialog.getWindow().setAttributes(wmlp); //force change, even at runtime. } catch (Exception e) { e.printStackTrace(); } }
From source file:com.sonvp.tooltip.Tooltip.java
private Tooltip(Builder builder) { this.builder = builder; this.anchorView = builder.anchorView; this.gravity = builder.tooltipGravity; if (builder.dismissOutsideTouch) { rootView = (ViewGroup) anchorView.getRootView(); overlay = new View(builder.context); overlay.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // overlay.setBackgroundColor(builder.context.getResources().getColor(android.R.color.holo_green_light)); overlay.setOnTouchListener(this); rootView.addView(overlay);/*from ww w . j av a 2s. com*/ } // TODO container should NOT capture all events container = new LinearLayout(builder.context); container.setOnClickListener(this); int backgroundColor = builder.backgroundColor; viewTooltip = getViewTooltip(builder, backgroundColor); rectAnchorView = getRectView(anchorView); changeGravityToolTip(); if (builder.arrowDrawable == null) { builder.arrowDrawable = new ArrowDrawable(backgroundColor, gravity); } arrow = new ImageView(builder.context); // TODO supports Gravity.NO_GRAVITY switch (gravity) { case Gravity.LEFT: container.setOrientation(LinearLayout.HORIZONTAL); container.addView(viewTooltip, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); arrow.setImageDrawable(builder.arrowDrawable); container.addView(arrow, new LinearLayout.LayoutParams((int) builder.arrowWidth, (int) builder.arrowHeight)); break; case Gravity.RIGHT: container.setOrientation(LinearLayout.HORIZONTAL); arrow.setImageDrawable(builder.arrowDrawable); container.addView(arrow, new LinearLayout.LayoutParams((int) builder.arrowWidth, (int) builder.arrowHeight)); container.addView(viewTooltip, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); break; case Gravity.TOP: container.setOrientation(LinearLayout.VERTICAL); container.addView(viewTooltip, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); arrow.setImageDrawable(builder.arrowDrawable); container.addView(arrow, new LinearLayout.LayoutParams((int) builder.arrowWidth, (int) builder.arrowHeight)); break; case Gravity.BOTTOM: container.setOrientation(LinearLayout.VERTICAL); arrow.setImageDrawable(builder.arrowDrawable); container.addView(arrow, new LinearLayout.LayoutParams((int) builder.arrowWidth, (int) builder.arrowHeight)); container.addView(viewTooltip, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); break; } popupWindow = new PopupWindow(container, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); popupWindow.setOnDismissListener(this); popupWindow.setClippingEnabled(false); popupWindow.setAnimationStyle(android.R.style.Animation); // popupWindow.setBackgroundDrawable(builder.context.getResources().getDrawable(android.R.color.holo_blue_bright)); }
From source file:com.oshi.librcalendarwidget.views.WrapContentHeightViewPager.java
/** * Allows to redraw the view size to wrap the content of the bigger child. * * @param widthMeasureSpec with measured * @param heightMeasureSpec height measured *///from www .java 2 s . com @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); widthMeasuredSpec = widthMeasureSpec; int mode = MeasureSpec.getMode(heightMeasureSpec); if (mode == MeasureSpec.UNSPECIFIED || mode == MeasureSpec.AT_MOST) { if(height == 0) { // measure vertical decor (i.e. PagerTitleStrip) based on ViewPager implementation decorHeight = 0; for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); LayoutParams lp = (LayoutParams) child.getLayoutParams(); if(lp != null && lp.isDecor) { int vgrav = lp.gravity & Gravity.VERTICAL_GRAVITY_MASK; boolean consumeVertical = vgrav == Gravity.TOP || vgrav == Gravity.BOTTOM; if(consumeVertical) { decorHeight += child.getMeasuredHeight() ; } } } // make sure that we have an height (not sure if this is necessary because it seems that onPageScrolled is called right after int position = getCurrentItem(); View child = getViewAtPosition(position); if (child != null) { height = measureViewHeight(child); } Log.d(TAG, "onMeasure height:" + height + " decor:" + decorHeight); } int totalHeight = height + decorHeight + getPaddingBottom() + getPaddingTop(); heightMeasureSpec = MeasureSpec.makeMeasureSpec(totalHeight, MeasureSpec.EXACTLY); Log.d(TAG, "onMeasure total height:" + totalHeight); } super.onMeasure(widthMeasureSpec, heightMeasureSpec); }
From source file:com.ymt.demo1.plates.exportConsult.ExportConsultMainActivity.java
protected void initTitle() { final MyTitle title = (MyTitle) findViewById(R.id.my_title); title.setTitleStyle(MyTitle.TitleStyle.RIGHT_ICON_L_R); title.setOnLeftActionClickListener(new MyTitle.OnLeftActionClickListener() { @Override/*from ww w . j a v a2 s. co m*/ public void onClick() { finish(); } }); actionListener = new PopActionListener() { @Override public void onAction(String action) { switch (action) { case "?": if (!(TextUtils.isEmpty(AppContext.now_session_id))) { Intent intent = new Intent(ExportConsultMainActivity.this, ConsultNowActivity.class); startActivity(intent); } else { Intent intent = new Intent(ExportConsultMainActivity.this, SignInUpActivity.class); intent.putExtra("isFromConsult", true); startActivity(intent); } break; case "": if (TextUtils.isEmpty(AppContext.now_session_id)) { // Intent intent = new Intent(ExportConsultMainActivity.this, SignInUpActivity.class); intent.putExtra("is_back_to_main", false); startActivityForResult(intent, 1024); } else { // startActivity(new Intent(ExportConsultMainActivity.this, MyConsultActivity.class)); } break; case "?": startActivity(new Intent(ExportConsultMainActivity.this, MyHistoryConsultActivity.class)); break; default: break; } } @Override public void onDismiss() { } }; title.setOnRightActionClickListener(new MyTitle.OnRightActionClickListener() { @Override public void onRightLClick() { startActivity(new Intent(ExportConsultMainActivity.this, FullSearchActivity.class)); } @Override public void onRightRClick() { PopActionUtil popActionUtil = PopActionUtil.getInstance(ExportConsultMainActivity.this); if (TextUtils.isEmpty(AppContext.user_type)) { popActionUtil.setActions(new String[] { "?", "", "?" }); } else { switch (AppContext.user_type) { case "003": // case "004": // popActionUtil.setActions(new String[] { "" }); break; default: // popActionUtil.setActions(new String[] { "?", "", "?" }); break; } } PopupWindow popupWindow = popActionUtil.getSimpleTxtPopActionMenu(); popupWindow.showAtLocation(title.getRootView(), Gravity.TOP | Gravity.END, 10, 100); popActionUtil.setActionListener(actionListener); } }); }