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

How to close or hide the android soft Keyboard

Solution: You can force the android to close the virtual keyboard. hideSoftInputFromWindow function to close the virtual keyboard Code: View myview = this . getCurrentFocus (); if (myview != null ) { InputMethodManager inm = ( InputMethodManager ) getSystemService ( Context . INPUT_METHOD_SERVICE ); inm . hideSoftInputFromWindow ( view . getWindowToken (), 0 ); }

Share movies from android phone to laptop in share it || share files from phone to laptop || share files from android phone to macbook

Solution: 1. Open share it in your phone. 2.In home screen top right corner four cube icon is shown click on that. 3. In that select option share jio. 4.It will navigate you one screen and shows wifi name and password. 5.Goto your system select that wifi and connect using the password shown in the phone screen. 6.After connected search the files you want to share in your phone. 7.Goto the laptop and open browser and open the below link http://192.168.43.1:2999/ 8. The shared files will be shown in browser.Click the download icon for individual files and download.

Gradle sync error Error:Failed to resolve: com.android.support

The project was working Fine. But suddenly it throws the following error. app\build . gradle Error : Error : Failed to resolve : com . android . support : support - annotations : 27.0 . 1 Install Repository and sync project Error : Error : Failed to resolve : com . android . support : appcompat - v7 : 27.0 . 1 Install Repository and sync project Error : Error : Failed to resolve : com . android . support : customtabs : 27.0 . 1 Install Repository and sync project Error : Error : Failed to resolve : com . android . support : cardview - v7 : 27.0 . 1 Install Repository and sync project Error : Error : Failed to resolve : com . android . support : support - v4 : 27.0 . 1 Install Repository and sync project Error : Error : Failed to resolve : com . android . support : support - core - utils : 27.0 . 1 Install Repository and sync project Reason: It suddenly shows error because of Facebook has updated the SDK and removed suppor...