rey5137 / material

A library to bring fully animated Material Design components to pre-Lolipop Android.
http://rey5137.com/material/
Apache License 2.0
6k stars 1.32k forks source link

LineMorphingState FAB don't work? #434

Open iljyya opened 7 years ago

iljyya commented 7 years ago
public class MainActivity extends AppCompatActivity {
    private Drawable[] mDrawables = new Drawable[2];
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        View v = R.layout.activity_main;
        mDrawables[0] = v.getResources().getDrawable(R.drawable.ic_autorenew_white_24dp);
        mDrawables[1] = v.getResources().getDrawable(R.drawable.ic_done_white_24dp);
        final FloatingActionButton fab_line = (FloatingActionButton) findViewById(R.id.fab_line);
        fab_line.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                fab_line.setLineMorphingState((fab_line.getLineMorphingState() + 1) % 2, true);
            }
        });
    }
}

Click fab cannot change the drawable, what's wrong indeed? Layout , styles, states file is all fine, I think.

lihongjian commented 6 years ago

you need to add ThemeManager.init(this, 2, 0, null);
at your application class . reference DemoApplication.java