How to how to customize snackBar's layout in Android?

Azhar
Updated on 15-Nov-2019 11:55:11

265 Views

This example demonstrates how to customize snackBar's layout in Android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.javapackage com.androidmads.ajts.customsnackbar; import android.graphics.Color; import android.graphics.Typeface; import android.os.Build; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.widget.Button; import android.widget.FrameLayout; import android.widget.TextView; import static java.security.AccessController.getContext; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);   ... Read More

How to change the background color of the options menu in Android?

Azhar
Updated on 15-Nov-2019 11:50:46

5K+ Views

This example demonstrates how to change the background color of the options menu in Android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         Step 3 − Add the following code to res/menu/menu_items.xml             Step 4 − Add the following code to res/values/styles.xml           @color/colorPrimary       @color/colorPrimaryDark       @color/colorAccent       @color/colorPrimary       @color/skyBlue ... Read More

How to make surfaceview transparent in an Android App?

Azhar
Updated on 15-Nov-2019 11:28:08

616 Views

This example demonstrates how to make surfaceview transparent in an Android App.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         Step 3 − Add the following code to src/MainActivity.javapackage com.app.sample; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    } }Step 4 − Add the following code to Manifests/AndroidManifest.xml     ... Read More

How to change colors of a Drawable in Android?

Azhar
Updated on 15-Nov-2019 11:24:26

2K+ Views

This example demonstrates how to change the colors of a Drawable in Android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.javapackage com.app.sample; import androidx.appcompat.app.AppCompatActivity; import android.graphics.drawable.AnimationDrawable; import android.os.Bundle; import android.widget.LinearLayout; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       LinearLayout your_Layout = (LinearLayout) findViewById(R.id.activity_main);       AnimationDrawable animationDrawable ... Read More

How to set Android Toast duration longer than Toast.LENGTH_LONG?

Azhar
Updated on 15-Nov-2019 11:11:12

834 Views

This example demonstrates how to set Android Toast duration longer than Toast.LENGTH_LONG.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         Step 3 − Add the following code to src/MainActivity.javapackage com.app.sample; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    }    private Toast mToastToShow;    public ... Read More

How to use Material Design components in an Android App?

Azhar
Updated on 15-Nov-2019 11:06:29

445 Views

This example demonstrates how to use Material Design components in an Android App.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                         Step 3 − Add the following code to src/MainActivity.javapackage com.app.sample; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    } }Step ... Read More

How to create transparent statusbar and ActionBar in Android?

Azhar
Updated on 15-Nov-2019 11:00:11

2K+ Views

This example demonstrates how to create a transparent statusbar and ActionBar in Android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.javapackage com.app.sample; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    } }Step 4 − Add the following code to res/values/styles.xml         ... Read More

How to filter a RecyclerView with a SearchView on Android?

Azhar
Updated on 15-Nov-2019 10:55:38

5K+ Views

This example demonstrates how to filter a RecyclerView with a SearchView on Android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.javapackage com.app.sample; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.inputmethod.EditorInfo; import android.widget.SearchView; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity {    private ExampleAdapter adapter;    private List exampleList;    @Override    protected void ... Read More

How do I change the background color of the ActionBar of an ActionBarActivity?

Azhar
Updated on 15-Nov-2019 10:43:40

795 Views

This example demonstrates how to change the background color of the ActionBar of an ActionBarActivityStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.javapackage com.app.sample; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    } }Step 4 − Add the following code to Manifests/AndroidManifest.xml ... Read More

How to change color and font of Android ListView?

Azhar
Updated on 15-Nov-2019 10:34:56

1K+ Views

This example demonstrates how to change the color and font of Android ListView.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.javaStep 4 − Add the following code to Manifests/AndroidManifest.xml                                                             ... Read More

Advertisements