‫Hello, my friends.
‫After we have added successfully that dependence is required for our project, the translator project
‫we are going to create, it's laid out.
‫So open the main activity dot example and let's add the two spinners that we are going to see as our
‫functionality throughout the app and we are going to add a text view and an edit text.
‫So let's add these widgets.
‫I will start by spinner here.
‫Rap content for the height and match parent for the width rap content.
‫This is the spinner.
‫And here the weight.
‫If we are going to use the linear layout idea, I will give it an ID ID from Spanish.
‫So we will use or we will create two spinners.
‫The first one, which is the from spinner, the language which we are translating from.
‫And the second spinner allows the user to select, which is the, the language that we need to translate
‫the text to margin.
‫I will add some margin like ten DPI.
‫It's good and I will get gravity.
‫I can make the constraints by inferring its constraints like this and adding some margins margin
‫margin left.
‫And margin.
‫Right.
‫Margin.
‫Right.
‫You can now drag and drop whatever you want.
‫Marching left.
‫Marching right.
‫Okay.
‫Margin left, it's capital letter because it's not getting it correctly.
‫Now, the second the second thing that we need to make is to add a text view.
‫So here I will add text to view rap content.
‫Rap content.
‫The text would be my translator, the size would be 32 speed.
‫And I will add the constraints to this.
‫Infer constraints.
‫I will drag and drop it and I will remove this constraint from here for the spinner.
‫And I will add like this.
‫This is good.
‫Now let's add the second spinner.
‫Which is for that translate.
‫Two.
‫Spinner.
‫And the same way match parent trap content and the ID ID to spin margin.
‫I will add the margins from here.
‫So I will drag it and drop it.
‫I will drag and drop it under the first spinner and I will add the.
‫The constraints from here attribute you can add the attributes from here like then the ten DPI it's
‫good and here ten dpi.
‫Okay.
‫This is what we can make.
‫Okay.
‫Now.
‫We will add.
‫And edit text.
‫So the user enter the text that we need to translate.
‫I will name it as.
‫Give it an ID.
‫I'd add a text source.
‫I will add the the with that as much burden and the height as rap content.
‫I will drag and drop it.
‫I will infer the constraints to it.
‫So I will add like 16 DPI from the left and 16 DPI from the right.
‫I will add the hint hint.
‫It's telling the user to enter the text to translate.
‫That's good.
‫Now
‫we need to add a button, an action button that allows us to click click it to start translating.
‫So button wrap content rep content.
‫The text on the button translate now.
‫And we will drag it and drop it here.
‫Add the constraints.
‫And infer sorry for the constraints.
‫And this is good.
‫Now we have text.
‫The spinner.
‫Spinner added text and a button.
‫Now.
‫The last thing that we need to add is a text view displaying the result of the translation.
‫So the text view would be that with as much parent rap content and I will give it an id id t v text
‫view.
‫Trans lated text view.
‫I d.
‫Okay.
‫The margin would be ten DPI.
‫I will add its constraints from here, from the button and infer the constraints.
‫And this is the code for it.
‫Till now we have finished creating our layout.
‫Later on, if we need to add some tweaks and some configurations, we can.
‫Now, one last thing I need to create is the item for a custom item for the spinner.
‫So I will create a new layout resource file and I will name it as spinner.
‫Right.
‫So Spinner underscore it.
‫This is a custom layout for our spinner.
‫It will contain a text of you here
‫containing a text of you with match per as width and wrap content as height and gravity would be centered,
‫and having padding for the P and text alignment would be center and the color text color would be black.
‫And I will add the size would be 24.
‫SB And in this way we have added the same constraints.
‫We have added everything.
‫We can also add the constraints like this.
‫Just infer the constraints.
‫In this way we have added our text view, which would be a custom text view inside a spinner item displayed
‫inside these spinners.