Skip to main content

Posts

Showing posts from February, 2017

Floating Label for EditText

Because of space constraints, it is difficult to create self explanatory forms in mobile apps. Do you write a label for each field? If yes, the labels will also take half of the space in your form.

Hints solve the problem to some extent. If you add a hint for an EditText, when the field is blank, this hint is shown.


<EditText android:layout_width="match_parent"android:layout_height="wrap_content"android:id="@+id/et1"android:hint="Name"/>
So now our hint is shown in Edit Text like this

But the moment you start entering value into the field, the hint vanishes.


To overcome this problem, support library comes to our rescue. It has a layout called TextInputLayout which places the hint as a floating label.

To use this first you need to add two lines to your build.gradle file in yourapplication/app directory.


dependencies { compile fileTree(dir:'libs',include:['*.jar']) compile 'com.android.support:appcompat-v7:25.1…

C++ Notes published

I have published my next app - C++ Notes

The app has short notes on basic and advanced topics of C++ along with quiz and programs.

I have tried to use material design here - may not be so successful. And have used firebase ads instead of admob. Admob has now become firebase.

Be careful, when you add firebase ads, three extra permissions are added to the app - WAKELOCK and some c2d -permission-receive and c2d message. And users will wonder why the hell this app needs these permissions.

So you can add these lines in your manifest file to remove these permissions.
 <uses-permission android:name="android.permission.WAKE_LOCK" tools:node="remove" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" tools:node="remove" /> <uses-permission android:name="your.app.package.permission.C2D_MESSAGE" tools:node="remove" /> I spent quite some time on deciding about scrolling and swiping. Notes ha…