Material design backdrop android example

Material design backdrop android example - Hello friend inabnomaniiyaha, In the article that you read this time with the title Material design backdrop android example, we have prepared this article well for you to read and take information in it. hopefully the contents of the post Artikel Material-Design,what we write you can understand. Alright, happy reading.

Judul : Material design backdrop android example
link : Material design backdrop android example

Baca juga


Material design backdrop android example

A backdrop appears behind all other surfaces in an app, displaying contextual and actionable content.
A backdrop appears behind all other surfaces in an app, displaying contextual and actionable content.
Usage
A backdrop is composed of two surfaces: a back layer and a front layer. The back layer displays actions and context, and these control and inform the front layer's content.
A simple implementation of material design backdrop.
Material design backdrop android example

Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
        implementation 'com.github.milindrc:BackdropEasy:v0.1'
}
Usage
public class TestActivity extends BackdropListActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
    }
    @Override
    public int getMenu() {
return R.menu.main;
    }
    @Override
    public Fragment getFragment(MenuItem item) {
switch (item.getItemId()){
    case R.id.a: getBinding().headerTitle.setText("Category A"); return BlankFragment.newInstance("A","");
    case R.id.b: getBinding().headerTitle.setText("Category B"); return BlankFragment.newInstance("B", "");
    case R.id.c: getBinding().headerTitle.setText("Category C"); return BlankFragment.newInstance("C", "");
    case R.id.d: getBinding().headerTitle.setText("Category D"); return BlankFragment.newInstance("D", "");
    case R.id.e: getBinding().headerTitle.setText("Category E"); return BlankFragment.newInstance("E", "");
    case R.id.f: getBinding().headerTitle.setText("Category F"); return BlankFragment.newInstance("F", "");
    case R.id.g: getBinding().headerTitle.setText("Category G"); return BlankFragment.newInstance("G", "");
    default: return null;
}
    }
}
Menu example:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">


    <group
android:id="@+id/group"
android:checkableBehavior="single"
>
<item
    android:checkable="true"
    android:id="@+id/a"
    android:title="A" />
<item
    android:checkable="true"
    android:id="@+id/b"
    android:title="B" />
<item
    android:id="@+id/c"
    android:checkable="true"
    android:title="C" />
<item
    android:id="@+id/d"
    android:checkable="true"
    android:title="D" />
<item
    android:checkable="true"
    android:id="@+id/e"
    android:title="E" />
    </group>

</menu>
Styling
For styling add these to your theme
<color name="back_layer_color">#4527A0</color>
<color name="front_layer_color">#ffffff</color>
Useful functions
Access any view on screen
getBinding()
Or you could inflate your own menu with searchview in toolbar

Enable search view in toolbar

setToolbarSearchEnabled(true);
getBinding().toolbarSearch // to get the instance
Click Control
For custom action on item click and preventing frament change refer this example

//ovveride this function in your activity

public boolean onClickMenuItem(MenuItem item){
    if(item.getItemId()==R.id.sign_out){
        signOut();
        return true;
    }
    return false;
}
Github: http://github.com/milindrc/BackdropEasy


That's the articleMaterial design backdrop android example

That's it for the article Material design backdrop android example this time, hopefully can be useful for all of you. well, see you in another article post.

You are now reading the articleMaterial design backdrop android example with link addresshttps://inabnonapudyawanabing.blogspot.com/2020/07/material-design-backdrop-android-example.html

0 Response to "Material design backdrop android example"

Post a Comment

Tips Tricks for Android Phone

Tips & Tricks for Android Phone is a free android app and Collection of Tips and Tricks related to using your android mobile device lik...