Skip to main content

Change the color of all Children Element

Solution:

 If you had a linear layout with two children then change all the child color without know their id.

Code:
for (int i = 0; i < yourlayout.getChildCount(); i++) {
        View v = layout.getChildAt(i);
        v.setBackgroundColor(/* color you want*/);
}
}

Comments

Popular posts from this blog

Local variable for "serviceWorkerVersion" is deprecated in flutter

Problem:  Local variable for "serviceWorkerVersion" is deprecated. Use "{{flutter_service_worker_ version}}" template token instead. See  https://docs.flutter.dev/ platform-integration/web/ initialization  for more details. While try to run my flutter app in chrome it shows the above error. Solution: In script file it shows as like below < script > // The value below is injected by flutter build, do not touch. var serviceWorkerVersion = null ; </ script > Replace with below.It will works fine. < script > // The value below is injected by flutter build, do not touch. var serviceWorkerVersion = "{{flutter_service_worker_ version}}" ; </ script >

FlutterLoader.loadEntrypoint is deprecated. Use "FlutterLoader.load" instead. While run flutter for chrome

 Problem: "FlutterLoader.loadEntrypoint" is deprecated. Use "FlutterLoader.load" instead. The above error will show while run my flutter app in chrome. Solution: The error because entry point is not set in your flutter app. < script > window . addEventListener ( 'load' , function ( ev ) { // Download main.dart.js _flutter . loader . loadEntrypoint ({ serviceWorker : { serviceWorkerVersion : serviceWorkerVersion , }, Then replace with below code it will works. window . addEventListener ( 'load' , function ( ev ) { // Download main.dart.js _flutter . loader . load ({ serviceWorker : { serviceWorkerVersion : serviceWorkerVersion , },