Top Menu

Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Wednesday 30 September 2015

How to write multi-line in EditText view

Hey guys,

I have facing problem while creating an EditText view which support multi-lines as on some application it required on creating some Form which need it.

So here I am giving you the sample code to solve this problem and save your time.

By default all the EditText widgets in Android are multi-lined.
<EditText
    android:inputType="textMultiLine" <!-- Multiline input -->
    android:lines="8" <!-- Total Lines prior display -->
    android:minLines="6" <!-- Minimum lines -->
    android:gravity="top|left" <!-- Cursor Position -->
    android:maxLines="10" <!-- Maximum Lines -->
    android:layout_height="wrap_content" <!-- Height determined by content -->
    android:layout_width="fill_parent" <!-- Fill entire width -->
    android:scrollbars="vertical" <!-- Vertical Scroll Bar -->
/>

Read more...

Create Custom Spinner with background shape

Hello Guys,

If you are looking for creating Custom Spinner like this
enter image description here

Then I am here to help you :-)
Create an XML in drawable folder with any name for example spinner_bg.xml and add the following lines
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <layer-list>
            <item>
                <shape>
                    <stroke android:width="3dp" android:color="#ebebeb" />

                    <corners android:radius="5dp" />

                    <solid android:color="#fff"></solid>
                </shape>
            </item>
            <item>
                <bitmap android:gravity="bottom|right" android:src="@drawable/ic_arrow_drop_down" />
            </item>
        </layer-list>
    </item>
</selector>
Add the following lines to your styles.xml which is inside values folder
<style name="spinner_style" >
    <item name="android:background">@drawable/spinner</item>
    <item name="android:popupBackground">#DFFFFFFF</item>
</style>
Now add this style to your spinner as

<Spinner
    android:id="@+id/condition"
    style="@style/spinner_style"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="16dp"
    android:layout_marginRight="16dp"
    android:layout_marginTop="15dp"
    android:popupBackground="#cccccc" />




Read more...

Saturday 12 September 2015

Set the Genymotion Android Emulator in Windows

What is Genymotion ?

Genymotion is the fastest Android emulator for app testing. Genymotion is the evolution of AndroidVM open source project, already trusted by 300 000 developers. Here I am using 64 bit Windows 8 for using Genymotion. Here we are going to setup Android 4.2.2 on a Windows operating system using Genymotion.

 

Features of Genymotion:

1.Fastest Android emulator on the planet.
2.Do your simultanous automatic tests on unlimited virtual appliances .
3.Directly launch Genymotion from your Eclipse and Android Studio platforms.
4.It has Open GL acceleration ,multiscreen and full screen display.

 

Configure Genymotion with Android Studio:

1.Download genymotion-idea-plugin-20130716.jar plugin from the link http://plugins.genymotion.com/plugins/idea/1.0.1/genymotion-idea-plugin-20130716.jar
2.Open Android Studio IDE
3.Open File->Settings and the IDE Settings->Plugins
4.Choose Install plugin from disk and choose the downloaded genymotion-idea-plugin-20130716.jar
5.Now Apply Changes
6.In Android Studio select Run->Edit configurations
7.Select Target device as Show chooser dialog.
8.Now you can test your Application in Genymotion by choosing Genymotion from the Choose Device dialog while running your Application.
Read more...

Thursday 10 September 2015

android: How to make the button transparent and have background color

Using XML
If you want to set color and along with that if you want to set transparent then you have to use that color code .

android:color="#66FF0000"    // Partially transparent red
android:alpha="0.25"         // 25% transparent 

Using java
And if you want to set dynamically (java code)then try this,

myButton.getBackground().setAlpha(64);  // 25% transparent

- i.e .INT ranges from 0 (fully transparent) to 255 (fully opaque)


Reference- http://stackoverflow.com/questions/20743124/setting-transparency-to-buttons-in-android
Read more...