ViewPager with TabLayout Android Studio

viewpager with custom tab

In this article we will learn how to create ViewPager with TabLayout Android Studio. We use ViewPager to create a view the works as Image Slider. In this tutorial I will use the ViewPager2 Class and accordingly I will use the RecyclerView Adapter Class. Lets create a new android studio project with Java language. First, we need to add the required dependences as following in the Gradle file, in module Gradle file. Note, that I am using the Java version of 1.8 and ViewBinding. Then, Open theme file in the…

Read More

How to Create SearchView in Android Studio

How to Create SearchView in Android Studio

In this article we will learn how to create SearchView in android studio. SearchView is a widget that enables the user to enter search query and then send the request to the search provider. After that it shows a list of suggestion or results. Copy the following xml code in main activity xml file. After that add the following code to the main activity java file. Now, run the app. You will find the result as the following image. Then open logCat in the bottom bar of android studio. In…

Read More

Setting ImageView in Android Studio

Setting ImageView in Android Studio

In this article talks about setting ImageView in android studio. ImageView is a View for displaying and manipulating image resources, such as Drawables and Bitmaps. See the following example to implement ImageView to switch between images I have saved in the drawable folder . Then, in the main activity past the following code. Not you need to save three image files in the drawable folder and make sure the files names are with lowercase letters, no numbers or spaces. The layout should be like this Now run the app and…

Read More

TextInput Layout in Android Studio

TextInput Layout in Android Studio

In this article we will how to work with TextInput Layout in android studio. We need to use TextInput Layout to display the floating label on EditText. Furthermore TextInputLayout wraps an EditText in order to display the floating label. Moreover, it supports showing the error and error icon. The TextInput Layout uses TextInputEditText as a child layout. Using TextInputEditText instead of an EditText provides accessibility support for the text field and allows TextInputLayout greater control over the visual aspects of the text field. An example usage is as so: TextInput…

Read More

Custom ListView in Android Studio

Custom ListView in Android Studio

In this article we will learn how to work with Custom ListView in android studio. ListView is a viewgroup which groups several items from a data source like array or database and displays them in a scroll-able list. Moreover, ListView uses the Adapter to bind the data. In order to create a ListView widget we need to add it in the xml file as following. ListView with Custom ArrayAdapter By default the ArrayAdapter class creates a view for each array item by calling toString() on each item and placing the…

Read More

AutoComplete TextView Android Studio

AutoComplete TextView Android Studio

In this article we will learn how to create AutoComplete TextView in android studio. Furthermore, autocomplete textview is used when we need to show a list of text like name, cities when the user type the first letters in the text. AutoComplete TextView is a UI widget. So that, when we need to create it we need to add it in the xml layout file as following: The AutoComplete TextView uses a list in order that we need to create adapter for this list. The adapter requires another XML layout…

Read More

Working with EditText in Android Studio

Working with EditText in Android Studio

In this article we will learn the working with EditText in android studio. The EditText is the standard text entry widget in Android apps. Moreover, If the user needs to enter text into an app, this is the primary way for them to do that. We can customize the behavior of an EditText by using several attributes as following. In order to get the text value in EditText we can use the following method. Furtheromer, We might want to limit the entry to a single-line of text (avoid newlines): Also,…

Read More

Customize TextView in Android Studio

Customize TextView in Android Studio

In this article we will learn how to customize TextView in android studio. TextView is a user interface widget that display and set text to the user. In order to create text view use the following example of TextView widget. Moreover, you can use the xml layout attributes to customize the TextView. Also, there is another way to customize TextView which is Spannable Text View. Through the next part of this article we learn how to use it. Moreover, when we want to use the text view in the java…

Read More

Button Click Listener in Android Studio

Button and Button Click listener

In this article we will learn how to create Button also how to create Button Click Listener in android studio. Buttons are the most used widgets in any android app. In other words the Click Listener interface also. In order to create Button we to add its widget in the XML file as following. Note that the attribute onClick, that specifies the action the will be done when the user click the button. This attribute take the name of the method in the linked java file. as following. Using the…

Read More