Android Programming -4 Button Component

Hi guys in this tutorial  I will talk about button component.

In my previous tutorial, I mentioned the textview and edittext components. If you have not read it yet, I recommend you read it first.

https://ittutorial.org/android-programming-3-textview-and-edittext-components/

If we go through the login page, when user enters user name and password with edittexts, we need check the correctness of the entered password. Because according to this result, either the user will login to the application and access the data or login to the wrong password error. Therefore, it is very important that this control mechanism works correctly.

It is as important as when this control structure will work correctly.

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

<Button

     android:id="@+id/button_id"
     android:layout_centerInParent="true"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android: text_color="#ffff"
     android:backgroud="#4b5320"
     android:text="Giriş Yap" /> 

</RelativeLayout>

Height, weight and id variables, which are common to all components, are defined. The following set of features is entirely for the design of the page.

For example, my design is at the bottom and in the middle of the page. The color is green and the text on it is black. But your design is below the button textview in 20 dp, 40 dp margins from left and right and Color can be purple and text color can be white.

As you can see, the features we set depend entirely on the design. For this example, android: layout_centerInParent = ”True” feature in the middle of the page we have made the button.

 

 

About Kübra Hebeş

Bilgisayar Mühendisi

Leave a Reply

Your email address will not be published. Required fields are marked *