<center><h2>𝓖𝓻𝓮𝓮𝓽𝓲𝓷𝓰𝓼</h2></center> <div class="text-justify"> Hello, dear Hive Learners, I hope you all are well. We are going to continue our Android Development course. Today we will add a new Button on our mobile screen. We can use this Button with an icon with it. Sometimes we also need to show the icon with the text, We use the Material Button with the style property.  ### [GitHub Link](https://github.com/faisalamin9696/HiveLearners) Use this GitHub project to clone into your directory. It will always get updated in the next lecture. So that you will never miss the latest code. Happy Coding!. ### What Should I Learn - What is Material Button - How to set Icon - How to align the icon and text ### Assignment - Add a Material Button in your Activitty - Change the icon and set the tint - Align the icon and text We need to add the Material Button to our design activity if you remember it comes from the same library that we add in our [Lecture-6](https://ecency.com/hive-153850/@faisalamin/android-app-development-or-beginner-be92aa7c6f617). This library gives us a bunch of Material Design to implement that is very useful than the default options. ``` <com.google.android.material.button.MaterialButton style="@style/Widget.AppCompat.ImageButton" android:layout_width="wrap_content" android:layout_height="wrap_content" /> ```  The Button is looking so empty so If I need to add our Hive Learners logo as the start icon in this button I use these code lines. I also set the text in the Button and the size of the icon and TintMode to multiple so that our icon color looks original. Otherwise, it will turn black or white. ``` app:icon="@drawable/hive_logo" app:iconSize="30dp" app:iconTintMode="multiply" android:text="Hive Learners" ```  If you notice the text **Hive Learners** in the button is not in the center of the button. Or we can say that the icon and the text are not aligned. We can fix it by using the inside gravity option. Use this code in the Button and set it in the center. ``` android:gravity="center" ```  I hope you enjoy today's lecture and learn something new, From tomorrow we will learn how to link this design item with the code to act actually. here is the full ```main_activity.xml``` code. ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity"> <Button android:id="@+id/start_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:backgroundTint="#3F51B5" android:text="Hive Learners Start Button Colored" android:textColor="#FFEB3B" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="sans-serif-smallcaps" android:text="faisalamin" android:textColor="@color/teal_700" android:textSize="16sp" android:textStyle="italic|bold" /> <com.google.android.material.textfield.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Enter Password" app:passwordToggleEnabled="true"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPassword" android:text="+923451111111" android:textColor="@color/black" android:textColorHint="@color/purple_200" android:textSize="14sp" /> </com.google.android.material.textfield.TextInputLayout> <ImageView android:layout_width="200dp" android:layout_height="200dp" android:src="@drawable/hive_logo" /> <com.google.android.material.button.MaterialButton style="@style/Widget.AppCompat.ImageButton" android:layout_width="wrap_content" android:layout_height="wrap_content" app:icon="@drawable/hive_logo" app:iconSize="30dp" app:iconTintMode="multiply" android:text="Hive Learners" android:gravity="center"/> </LinearLayout> ``` <center>  <h2>Thank You</h2>  <div class="pull-left"><a href="https://discord.gg/7Bzqv4qUMT"> <img src="https://cdn.steemitimages.com/DQmXd6PwGUHRgSDkWtwKfDvdFpaLHXvXBdK7wnYZeqe1GUa/discord_animation_logo.gif"/></a> </center>
author | faisalamin |
---|---|
permlink | android-app-development-or-beginner-b32376420dc4 |
category | hive-153850 |
json_metadata | "{"links": ["https://github.com/faisalamin9696/HiveLearners", "https://ecency.com/hive-153850/@faisalamin/android-app-development-or-beginner-be92aa7c6f617", "http://schemas.android.com/apk/res/android", "http://schemas.android.com/apk/res-auto", "http://schemas.android.com/tools", "https://discord.gg/7Bzqv4qUMT"], "image": ["https://images.ecency.com/DQmaYjaaUaXy2kp6wVTriuo7Ut5ngxdKB9VoTVDJgjCrD9Z/multi_purpose.png", "https://images.ecency.com/DQmWPrmHHQ2Ztdnq8b4dQcht4hKHqjysiZ92CnRqsacMxtN/image.png", "https://images.ecency.com/DQmdorwCP1bsQ2MhLCyAskjoEDWhTfcx5LtkbEtTA77PF9L/image.png", "https://images.ecency.com/DQmPcM8ocCdkbzctqdQBj6ZmyR7qKeLbPr5aAEPRTc2LR4E/image.png", "https://images.ecency.com/DQmabQycJhW8DT8a634z3wQaVXvPZ5KMii2LYbaWZ3PsaRy/hl_divider.png", "https://images.ecency.com/DQmZ4HF3hjV4HwJXuw8vRJ6B6CiMC3kUkkoihjtm7z2Gii7/hl_footer_banner.png", "https://cdn.steemitimages.com/DQmXd6PwGUHRgSDkWtwKfDvdFpaLHXvXBdK7wnYZeqe1GUa/discord_animation_logo.gif"], "thumbnails": ["https://images.ecency.com/DQmaYjaaUaXy2kp6wVTriuo7Ut5ngxdKB9VoTVDJgjCrD9Z/multi_purpose.png", "https://images.ecency.com/DQmWPrmHHQ2Ztdnq8b4dQcht4hKHqjysiZ92CnRqsacMxtN/image.png", "https://images.ecency.com/DQmdorwCP1bsQ2MhLCyAskjoEDWhTfcx5LtkbEtTA77PF9L/image.png", "https://images.ecency.com/DQmPcM8ocCdkbzctqdQBj6ZmyR7qKeLbPr5aAEPRTc2LR4E/image.png", "https://images.ecency.com/DQmabQycJhW8DT8a634z3wQaVXvPZ5KMii2LYbaWZ3PsaRy/hl_divider.png", "https://images.ecency.com/DQmZ4HF3hjV4HwJXuw8vRJ6B6CiMC3kUkkoihjtm7z2Gii7/hl_footer_banner.png", "https://cdn.steemitimages.com/DQmXd6PwGUHRgSDkWtwKfDvdFpaLHXvXBdK7wnYZeqe1GUa/discord_animation_logo.gif"], "tags": ["hive-153850", "hl-course", "stem", "neoxian", "education", "development", "dev", "programming", "android"], "description": "", "app": "ecency/3.0.23-vision", "format": "markdown+html"}" |
created | 2022-06-09 09:00:18 |
last_update | 2022-06-09 09:00:18 |
depth | 0 |
children | 0 |
last_payout | 2022-06-16 09:00:18 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 5.147 HBD |
curator_payout_value | 5.137 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 5,268 |
author_reputation | 104,701,778,605,493 |
root_title | "Android App Development | Beginner Course | Lecture#8 | Hive Learners" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 113,906,821 |
net_rshares | 22,076,765,958,971 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
team | 0 | 155,285,975,509 | 20% | ||
ebargains | 0 | 3,338,813,704 | 10% | ||
funnyman | 0 | 1,415,757,741 | 6% | ||
eliel | 0 | 16,928,181,895 | 7% | ||
improv | 0 | 5,626,891,461 | 1.5% | ||
alphacore | 0 | 2,797,750,223 | 1.61% | ||
codingdefined | 0 | 10,413,824,055 | 3% | ||
stinawog | 0 | 623,333,768 | 10% | ||
ernick | 0 | 1,092,259,422 | 10% | ||
crokkon | 0 | 4,547,161,085 | 8% | ||
estream.studios | 0 | 777,759,172 | 10% | ||
curx | 0 | 47,564,752,819 | 10% | ||
amico | 0 | 20,698,172,019 | 3.3% | ||
blainjones | 0 | 2,187,945,099 | 3.75% | ||
sustainablelivin | 0 | 537,645,844 | 5% | ||
steem.services | 0 | 25,102,693,788 | 10% | ||
gaottantacinque | 0 | 358,102,349 | 100% | ||
xves | 0 | 501,512,672 | 13% | ||
gasaeightyfive | 0 | 473,326,690 | 100% | ||
marcocasario | 0 | 213,031,262,964 | 100% | ||
cribbio | 0 | 1,109,615,805 | 100% | ||
ordinaryamerican | 0 | 1,222,638,216 | 10% | ||
tinyvoter | 0 | 1,156,844,229 | 10% | ||
optimizer | 0 | 898,754,978 | 10% | ||
infinite-love | 0 | 704,222,122 | 10% | ||
jacuzzi | 0 | 3,002,875,119 | 1.5% | ||
limka | 0 | 130,136,960 | 81.59% | ||
bergelmirsenpai | 0 | 632,857,024 | 10% | ||
elianaicgomes | 0 | 5,212,528,611 | 7.5% | ||
stem.alfa | 0 | 1,871,996,289 | 100% | ||
apx | 0 | 71,520,094 | 8% | ||
he-index | 0 | 4,193,262,206 | 15% | ||
scholaris.stem | 0 | 1,281,225,196 | 100% | ||
dronegirl | 0 | 303,969,549 | 100% | ||
cbridges573 | 0 | 1,036,464,148 | 3.75% | ||
mahirabdullah | 0 | 18,027,724,742 | 60% | ||
holovision.stem | 0 | 3,546,585,668 | 50% | ||
ziabutt3836 | 0 | 2,816,628,447 | 50% | ||
pi-trader | 0 | 77,733,969,320 | 50% | ||
offia66 | 0 | 6,787,558,756 | 100% | ||
arcgspy | 0 | 30,058,488,684 | 100% | ||
chincoculbert | 0 | 2,790,277,573 | 30% | ||
lazy-panda | 0 | 21,362,415,216,356 | 100% | ||
estherscott | 0 | 5,172,186,298 | 25% | ||
waivio.welcome | 0 | 538,550,516 | 1.07% | ||
gi-de-on | 0 | 2,334,032,825 | 30% | ||
lawrence27 | 0 | 4,477,289,483 | 50% | ||
emmanuel222 | 0 | 752,490,952 | 50% | ||
olivemarcel | 0 | 572,248,064 | 50% | ||
hive-learners | 0 | 2,515,148,118 | 100% | ||
auto-moderation | 0 | 10,276,869,971 | 98% | ||
prechidi | 0 | 1,730,739,849 | 50% | ||
niglys | 0 | 2,269,780,997 | 50% | ||
zeetunes | 0 | 4,328,463,544 | 100% | ||
protokkol | 0 | 1,489,675,983 | 100% |