Comments (13)
OK, found the issue. For some reason it must have a container, as such:
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<com.balysv.materialmenu.MaterialMenuView
android:id="@+id/navButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:mm_color="#ffcc0000"
app:mm_scale="1"
app:mm_strokeWidth="2"
app:mm_transformDuration="3000" />
</FrameLayout>
But why exactly?
from material-menu.
Could you provide your full xml for the error? According to the stack, it might be that other layouts are causing it
from material-menu.
@balysv Here it is after the "fix" (of adding the FrameLayout) .
The layout below mimics the toolbar used for Google Now (the search bar) .
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/searchCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="4dp"
app:cardElevation="4dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true"
app:contentPadding="4dp" >
<LinearLayout
android:id="@+id/searchCardContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="40dp"
android:orientation="horizontal" >
<View
android:id="@+id/focusStealer"
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<com.balysv.materialmenu.MaterialMenuView
android:id="@+id/navButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:mm_color="#FF000000" />
</FrameLayout>
<com.example.cardstest.EditText
android:id="@android:id/edit"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@null"
android:gravity="center_vertical"
android:hint="Search"
android:imeOptions="actionSearch"
android:inputType="phone"
android:singleLine="true"
tools:ignore="HardcodedText" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:background="@null"
android:padding="4dp"
android:src="@drawable/ic_av_mic" />
</LinearLayout>
</android.support.v7.widget.CardView>
from material-menu.
I've recreated the layout in an example project and it MaterialMenuView
successfully inflates in all common layouts including CardView
. Are you sure it's not your custom EditText causing it? If you can provide any more details, please do and I'll look into it.
from material-menu.
@balysv Did you remove the FrameLayout?
About the EditText, this is all that it has:
public class EditText extends android.widget.EditText {
private OnBackButtonPressedListener mOnBackButtonPressedListener;
public interface OnBackButtonPressedListener {
void onBackPressed();
}
public EditText(final Context context) {
super(context);
}
public EditText(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
public EditText(final Context context, final AttributeSet attrs, final int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public EditText(final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public void setOnBackButtonPressedListener(final OnBackButtonPressedListener onBackButtonPressedListener) {
this.mOnBackButtonPressedListener = onBackButtonPressedListener;
}
@Override
public boolean onKeyPreIme(final int keyCode, final KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK)
if (mOnBackButtonPressedListener != null)
mOnBackButtonPressedListener.onBackPressed();
return super.onKeyPreIme(keyCode, event);
}
}
It's used to capture the back button when the keyboard is shown.
from material-menu.
Yea, I've tried various configurations with no crashes.
from material-menu.
Can you provide the full stack given by the exception?
from material-menu.
I've worked on this project on Eclipse at work, so I can't test it right now. I can try to reproduce it at home with Android-Studio. Can you please let me know what should I add to the dependencies?
I've tried this one:
compile 'com.balysv.materialmenu:material-menu-toolbar:1.x.x'
Is this correct?
from material-menu.
You can check the latest version at Releases. Insert that number instead.
from material-menu.
@balysv Tested at home with just the layout I've sent you (and without the FrameLayout). Works just fine.
Not sure what caused it. Sorry I can't reproduce the issue.
Also, another thing that was weird for me is the animation usage. I remember that each time I wanted to show an animation (example: arrow->burger), I had to set the first state, even if it was already on this state.
And I couldn't reproduce this issue too...
No idea what's going on.
from material-menu.
It is likely to have something to do with Eclipse dependency management. I highly recommend using Studio.
I'm closing this issue for now then. Reopen if you find a way to reproduce it.
from material-menu.
It's at the office, so I can't force anyone to switch. I'm not in charge. I can't even switch myself (and let others use Ecilpse), since it's a different file structure than Eclipse.
Personally, I really like Eclipse, but Google stopped supporting it, so I've moved to Android-Studio. I like its features, but I still see a lot of things that I miss from Eclipse that don't exist there, and I also see a lot of annoyances.
from material-menu.
OK, I've now tried it at the office, and the bug is gone...
I have no idea how and why it happened.
Thank you anyway, and sorry for the false positive.
from material-menu.
Related Issues (20)
- Can't use with AppCompatActivity HOT 1
- Applying the CHECK animation to CAB HOT 2
- How i can use it? where i can find some demo of it? HOT 1
- New state, cross "+" HOT 1
- Error:Could not find com.balysv.materialmenu:material-menu-toolbar:1.x.x.
- How To Increase Or Decrease Left Right Top Bottom Padding Or Margin HOT 1
- Unable to set the menu icon to right hand? HOT 1
- Sloppy animation, if playing and in the same time keyboard is appearing on screen HOT 1
- The ripple animation on Icon is not showing HOT 1
- Arrow size is larger than normal HOT 1
- animateIconState during animation problem HOT 1
- Animate Icon When Searchview Expand HOT 1
- SharedElements HOT 1
- Adding to build.gradle issues HOT 8
- Wiki? HOT 1
- Why is there no center HOT 1
- Scale should be a float
- use in right of toolbar HOT 1
- Ususuusi
- Material menu
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from material-menu.