Closed ghost closed 3 years ago
This is the code I am using:
// inside onCreate of MainActivity TextView options = findViewById(R.id.optionsTextView); paintView.setOnCreateContextMenuListener(this); void createFancyPowerMenu(View view) { Log.d("PaintView", "huh, why???"); // create power menu item list List<PowerMenuItem> longPressMenuItems = Arrays.asList( new PowerMenuItem("PLACE ANCHORS"), new PowerMenuItem("NEW ELLIPSOID ID"), new PowerMenuItem("ELLIPSOID IDS"), new PowerMenuItem("GET SESSIONS"), new PowerMenuItem("SESSIONS") ); new PowerMenu.Builder(this) .addItemList(longPressMenuItems) .setCircularEffect(CircularEffect.INNER) .setLifecycleOwner(this) .setMenuRadius(10f) .setMenuShadow(10f) .setTextSize(12) .setTextColor(ContextCompat.getColor(this, R.color.white_transparent)) .setTextGravity(Gravity.CENTER) .setTextTypeface(Typeface.create("sans-serif-medium", Typeface.BOLD)) .setSelectedTextColor(android.graphics.Color.WHITE) .setMenuColor(android.graphics.Color.BLACK) .setFocusable(true) .setSelectedMenuColor(ContextCompat.getColor(this, R.color.aqua)) .build() .showAsDropDown(view); }
the text view XML
<TextView android:id="@+id/optionsTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/optionsTextViewLabel" android:textSize="20sp" android:padding="10dp" android:textColor="#fff" android:background="#000" />
I don't see anything when I execute the code
I fixed the problem by using .showAtLocation(this.getRootView(), 100, 100) instead
.showAtLocation(this.getRootView(), 100, 100)
This is the code I am using:
the text view XML
I don't see anything when I execute the code