question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optimize custom views

See original GitHub issue

What’s the problem

  • There are custom views, for instance, AddressInputView.
  • They are extended from ConstraintLayout or LinearLayout.
  • They inflate some layout file. For AddressInputView it’s view_input_address.xml
  • The view_input_address.xml layout root tag is also ConstraintLayout.
  • It resulted in double nested ConstraintLayout

How to resolve

Use merge tag in all such layout files. Check SwapAllowanceView for reference.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
abdrasulovcommented, Dec 10, 2020

Hi @herou. Please take this ticket, if you’re interested.

0reactions
abdrasulovcommented, Dec 17, 2020

image

@herou, there are some issues with layouts after replacing layouts with merge tags. We’ve found out that the root tags of layout files had some properties set before. After replacing them with the merge tag those properties are ignored. It can be resolved by setting properties in:

  1. The custom view programmatically
  2. Or in the places where the custom views are used

We should decide how to resolve it.

Also, there are some custom views left. Here is the list:

BackupWordView.kt  (1 usage found)
    11 inflate(context, R.layout.view_backup_word_text, this)
ConfirmationPrimaryView.kt  (1 usage found)
    14 inflate(context, R.layout.view_confirmation_primary_item_view, this)
ConfirmationSecondaryView.kt  (1 usage found)
    16 inflate(context, R.layout.view_confirmation_secondary_item_view, this)
ConfirmationSendButtonView.kt  (1 usage found)
    14 inflate(context, R.layout.view_button_with_progressbar, this)
FeeSelectorView.kt  (1 usage found)
    28 inflate(context, R.layout.view_send_fee, this)
FullTransactionInfoItemView.kt  (1 usage found)
    15 inflate(context, R.layout.view_transaction_full_info_item, this)
InputWithButtonsView.kt  (1 usage found)
    36 inflate(context, R.layout.view_input_with_buttons, this)
SettingItemWithCheckmark.kt  (1 usage found)
    13 inflate(context, R.layout.view_setting_item_with_checkmark, this)
SettingsView.kt  (1 usage found)
    26 inflate(context, R.layout.view_settings_item, this)
SettingsViewDropdown.kt  (1 usage found)
    22 inflate(context, R.layout.view_settings_dropdown, this)
SettingsViewSwitch.kt  (1 usage found)
    52 inflate(context, R.layout.view_settings_item_switch, this)
SwapAllowanceView.kt  (1 usage found)
    19 inflate(context, R.layout.view_swap_allowance, this)
SwapCoinCardView.kt  (1 usage found)
    47 inflate(context, R.layout.view_card_swap, this)
TransactionInfoItemView.kt  (1 usage found)
    12 inflate(context, R.layout.view_transaction_info_item, this)
TransactionInfoStatusView.kt  (1 usage found)
    29 inflate(context, R.layout.view_transaction_info_status, this)
TransactionProgressView.kt  (1 usage found)
    27 inflate(context, R.layout.view_transaction_progress, this)
TransactionStatusWithTimeView.kt  (1 usage found)
    27 inflate(context, R.layout.view_transaction_status, this)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimizing the View - Android Developers
The most important part of a custom view is its appearance. Custom drawing can be easy or complex according to your application's needs....
Read more >
How to optimize custom view? - android - Stack Overflow
So I defined an custom view based on LinearLayout: public class AlphabetButton extends LinearLayout{ private Button alphabetButton; ...
Read more >
Optimizing the View | Android Developers
If you have a complex UI, you should consider writing a custom ViewGroup to perform its layout. Unlike the built-in views, your custom...
Read more >
Objective overview - Optimize Resource Hub - Google Help
Optimize Permissions: Users with View access to the Optimize container can see that a custom objective was used in the experiment and the...
Read more >
#PerfMatters using custom Views in Android to improve ...
Custom Views and ViewGroups can be a great way to improve performance and make code more maintainable in your application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found