How To Stop EditText From Gaining Focus On Activity Start

There are times when we do not want the EditText component to gain focus and have the input keyboard show up.

What I wanted was the input keyboard to only show up when I tap on the EditText component.

Well, there is a solution to this without using code. Just add the attribute android:focusableInTouchMode=”true” in your layout where the EditText is part of and it won’t show the keyboard whenever the Activity starts.

How To Auto Adjust Google AdMob Container On Orientation Change In Android

There is no method to automatically change your Android app’s container size for showing Google AdMob ads. While it does re-adjust itself whenever the orientation changes, it does not resize itself to the correct size.

Try changing your device’s orientation from portrait to landscape mode and you will see that the height is the same. The result is that the height of the ad container shown is too big just like when its orientation is in portrait mode.

The workaround to make the ad container resize correctly according to orientation change like the image below is to remove the ad container in your layout view and add it back.

Say this is your code for adding the ad container view to your layout view.

Then place the method in the onConfigurationChanged().

Add Bottom Shadow In Any Layout Like Cards In Google Now

Coderwall created a layer list XML drawable in order to achieve this. A big thanks to him! This is how the XML file mydrawable.xml looks like:

Make sure you place this in the drawable folder.

To use this, simple set it as the value of the android:background attribute of any layout in your XML.

Related Posts Plugin for WordPress, Blogger...