(I do not know Brazilian portuguese.) The name of the feature you are trying to use is "dead keys". A dead key is chosen so that it has a label which is similar to an accent and when it pressed it does not create a new letter, you have to press a second key too. Some combination results in the accented version of the second letter.
There are more than one builtin keyboard layouts in Ubuntu even for a single language. As I see there are five for your language:
- Portuguese (Brazil)
- Portuguese (Brazil, Dvorak)
- Portuguese (Brazil, eliminate dead keys)
- Portuguese (Brazil, Nativo)
- Portuguese (Brazil, Nativo for US keyboards)
You have to choose either of 1, 4, 5. You can also choose the US international layout with dead keys, which seems to be popular among Brazilians:
- English (US, international with dead keys)
You can add a new layout by
- clicking on the input source (keyboard language layout) switcher near the right end of the panel to show the popup menu
- selecting Text Entry Settings from the menu
- Pressing the plus button below the Input sources to use list.
By the way, there is a keyboard icon on the right of the plus button which displays the chosen layout.
If you have more than one keyboard layout in your Input sources to use list, then you can switch them by either clicking on the input source icon on the profile or pressing Super + Space.
For example, if I select Portuguese (Brazil) I can type the letter á by pressing the English keys [a in sequence.
As usual, each of the things I mentioned above can be customized.