1
00:00:00,330 --> 00:00:08,300
So that we implemented our own trauma that we need to add our custom view to our activity underline

2
00:00:08,320 --> 00:00:09,870
main that example.

3
00:00:10,020 --> 00:00:13,690
So let's open our activity and illuminate exemplified here.

4
00:00:14,040 --> 00:00:18,350
Let's delete this hello world takes you here let's switch to the text tab.

5
00:00:18,870 --> 00:00:21,360
Let's go inside these constraints.

6
00:00:21,380 --> 00:00:31,270
Lay out and here let's say this actually of an attack and let's say that we have our my second he had

7
00:00:31,280 --> 00:00:37,940
my custom view as you can see as I'm typing my custom view is referring to this package to this class

8
00:00:37,940 --> 00:00:40,310
that we have inside the spec is my custom view.

9
00:00:40,550 --> 00:00:42,730
Let's use this font and the press and enter the channel.

10
00:00:42,810 --> 00:00:50,270
But it has calmed that example that Martha saw that this is the name of a package that custom view app

11
00:00:50,930 --> 00:00:53,480
that my custom view class.

12
00:00:53,480 --> 00:00:55,850
Now we can specify that lay.

13
00:00:55,900 --> 00:01:00,360
Beat the rap content against that content.

14
00:01:00,450 --> 00:01:03,370
Let's specify an I.D. for disgusting views.

15
00:01:03,420 --> 00:01:06,140
Second here ID outside Plus Id slash.

16
00:01:06,360 --> 00:01:18,580
So the idea is going to be custom view and also we have some specific attributes that we provided for

17
00:01:18,580 --> 00:01:19,500
this custom view.

18
00:01:19,510 --> 00:01:27,790
Inside are my custom view attributes that example we have for example the view color right the view

19
00:01:27,790 --> 00:01:29,230
color attribute.

20
00:01:29,230 --> 00:01:30,900
And here we can put a hash tag.

21
00:01:30,970 --> 00:01:34,370
For example I want the color of the view to be blue.

22
00:01:34,720 --> 00:01:36,400
We can use R.G. be colors.

23
00:01:36,520 --> 00:01:45,520
So for the R which is red we put 0 for the green again 0 0 and for the blue if we put nine of and for

24
00:01:45,520 --> 00:01:53,660
example if we have the text the color frequency takes color attribute hash stack and I want to text

25
00:01:53,680 --> 00:01:55,060
color to be red.

26
00:01:55,240 --> 00:02:01,670
So I put 9 9 0 0 0 0.

27
00:02:01,980 --> 00:02:07,240
And finally we have the text as your attribute so we can say just type in a text.

28
00:02:07,470 --> 00:02:10,590
As you can see it starts with app called in view text.

29
00:02:10,670 --> 00:02:18,530
It is related to our custom view right view text and the text is going to be awesome.

30
00:02:18,960 --> 00:02:22,080
So now we can run the app.

31
00:02:22,080 --> 00:02:27,640
So just like Just click on this play button run button.

32
00:02:27,840 --> 00:02:30,120
This use that emulator and then click on OK.

33
00:02:32,780 --> 00:02:43,400
Here we have our custom view inside our layout and we have this text here inside our view this circle.

34
00:02:43,400 --> 00:02:46,100
So that's it.

35
00:02:46,160 --> 00:02:48,640
Let's go back and read Sudoku as you can see.

36
00:02:48,740 --> 00:02:51,590
These errors are actually shown here.

37
00:02:51,620 --> 00:02:55,020
Now we can go inside is my custom we have a file.

38
00:02:55,220 --> 00:02:58,340
And if you want we can actually change these values.

39
00:02:58,340 --> 00:03:02,120
For example let's change this radius to 300.

40
00:03:02,210 --> 00:03:04,760
Let's run the app again.

41
00:03:04,760 --> 00:03:06,130
Let me show you the emulator.

42
00:03:06,410 --> 00:03:14,090
And here we have this awesome or for the X and for the circle X and the circle y we can change these

43
00:03:14,090 --> 00:03:19,650
values for we can say 500 for the second X and 500 for the circle Y.

44
00:03:20,210 --> 00:03:23,080
And as you can see the awesome text is here.

45
00:03:23,240 --> 00:03:31,850
But the shape or the circle is here and that's why we didn't put the x and y for these text.

46
00:03:31,850 --> 00:03:35,660
We also need to specify the x and y of the text.

47
00:03:35,660 --> 00:03:39,010
So let's change this one to five hundred and five on that.

48
00:03:39,020 --> 00:03:45,320
And that's why I told you you should specify to x and y the same as the circle.

49
00:03:45,510 --> 00:03:46,870
Let's run the app again.

50
00:03:46,920 --> 00:03:51,280
And here we have the awesome text at the center of our circle.

51
00:03:51,330 --> 00:03:53,980
We can also change the text size of our text.

52
00:03:54,000 --> 00:04:01,540
For example free let's change this thirty two for example 60 this Irania.

53
00:04:01,650 --> 00:04:03,000
Now we have this awesome.

54
00:04:03,120 --> 00:04:04,590
At the center of our circle.

55
00:04:04,900 --> 00:04:05,930
That's it.

56
00:04:06,390 --> 00:04:13,680
In the next tutorial we're going to show you how to manipulate this custom view how for example what

57
00:04:13,680 --> 00:04:17,700
happens when the user clicks or taps on this view.

58
00:04:17,990 --> 00:04:19,740
We're going to show you how to do that.

59
00:04:20,010 --> 00:04:21,530
Thank you very much for watching.

60
00:04:21,600 --> 00:04:23,760
And I will see you in the next tutorial.

