Top Menu

Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Wednesday, 30 September 2015

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...

Friday, 10 July 2015

Create Wordpress Website on a localhost using XAMPP

Hi Friends,

I believe this blog help you make it very simple to create your own website on Wordpress.
So without wasting much time lets start creating it,

1. Firstly download XAMPP.

    XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is           really very easy to install and to use - just download, extract and start.
    http://www.apachefriends.org/en/xampp

   
2. After completion of XAMPP download lets run the "XAMPP Control Panel"
    Start 'Apache' & 'MySQL'

3. Now download Wordpress from http://wordpress.org/download/

4. Extract the zip folder of wordpress in C:\xampp\htdocs\wordpress location

5. Click on the admin button on 'MySQL' from XAMPP control panel which opens http://localhost/phpmyadmin/

6. Create a new database by selecting new on left menu drawer and named it 'wordpress'

7. Now go to wordpress folder located in htdocs (C:\xampp\htdocs\wordpress) and open in Notepad/Notepad++ and change the database name default to 'wordpress' as shown below:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

and save as "wp-config.txt" in the same folder (C:\xampp\htdocs\wordpress)

8. Now go to webpage and open http://localhost/wordpress and select 'Create configure file'
and configure the wordpress page as mentioned below:

Database username - wordpress
User Name - root (default username for MySQL)
Password -  (can left blank)
Database Host - (left as it is)
Table Prefix - (left as it is)

9. Now select "Run the install" and you can see the Welcome page of Wordpress. Now you can create worpress page as you want (eg. shown below:)

Set Title - Test
Username - (enter whatever you need)
Password -
Confirm Password -
Your Email -

Make sure the Privacy should be checked.

And select 'Install WordPress'.
Now you can start with WordPress login details.

Thats it!

Now you can see your WordPress website by selecting test - View site from top menu bar.


Congratulations!!
You have created your own website. Enjoy!!!

Thanks




Read more...

Friday, 1 May 2015

Shake Animation Example

1.) Create a new project by File-> New -> Android Project name it ShakeAnimationExample.
2.) You will see some default code into your main.xml, strings.xml and android manifest file.
3.) Write following into main.xml file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical"
    android:padding="10dip"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    
    <TextView 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dip"
        android:text="Please enter your password:"
    />
    
    <EditText android:id="@+id/pw"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:singleLine="true"
        android:password="true"
    />

    <Button android:id="@+id/login"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Login"
    />

</LinearLayout>
4.) Create and Write following into anim/shake.xml:
<translate xmlns:android="http://schemas.android.com/apk/res/android"
 android:fromXDelta="0" android:toXDelta="10" android:duration="1000"
 android:interpolator="@anim/cycle_7" />
5.) Create and Write following into anim/cycle_7.xml:
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android" android:cycles="7" />
Steps:
1.) Create a project named ShakeAnimationExample and set the information as stated in the image.
2.) Open ShakeAnimationExample.java file and write following code there:
package com.example.ShakeAnimation;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Toast;

public class ShakeAnimation extends Activity implements View.OnClickListener {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        View loginButton = findViewById(R.id.login);
        loginButton.setOnClickListener(this);
    }

    public void onClick(View v) {
        Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
        findViewById(R.id.pw).startAnimation(shake);
        Toast.makeText(this, "Wrong Password", Toast.LENGTH_SHORT).show();
    }

}       
3.) Compile and build the project.
4.) Run on simulator or phone for the output.
Read more...

Thursday, 16 April 2015

Android character by character display text animation

This may not be the most elegant solution, but the simplest is probably a quick subclass of TextView with a Handler that updates the text every so often until the complete sequence is displayed:
 
public class Typewriter extends TextView {

    private CharSequence mText;
    private int mIndex;
    private long mDelay = 500; //Default 500ms delay


    public Typewriter(Context context) {
        super(context);
    }

    public Typewriter(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    private Handler mHandler = new Handler();
    private Runnable characterAdder = new Runnable() {
        @Override
        public void run() {
            setText(mText.subSequence(0, mIndex++));
            if(mIndex <= mText.length()) {
                mHandler.postDelayed(characterAdder, mDelay);
            }
        }
    };

    public void animateText(CharSequence text) {
        mText = text;
        mIndex = 0;

        setText("");
        mHandler.removeCallbacks(characterAdder);
        mHandler.postDelayed(characterAdder, mDelay);
    }

    public void setCharacterDelay(long millis) {
        mDelay = millis;
    }
}
You can then use this in an Activity like so:


public class MyActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Typewriter writer = new Typewriter(this);
        setContentView(writer);

        //Add a character every 150ms
        writer.setCharacterDelay(150);
        writer.animateText("Sample String");
    }
}
  
If you want some animation effects with each letter added, perhaps look at subclassing TextSwitcher instead.
Hope that Helps!

There are many ways to show the characters using "string.xml".
/* One method to get the characters from String*/
writer.animateText(getString(R.string.poem_one)); //get the text from string.xml
       
/* One more method to retrieve the character from String*/
CharSequence  cs = getText(R.string.poem_one);
writer.animateText(cs);
Read more...

Wednesday, 15 April 2015

How to create Ticker (marquee text)

If you want marquee text in your application, here is the simplest example.
In your xml-layout file, add this to your TextView
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
and in your code to start animation:
TextView tv = (TextView) findViewById(R.id.tv);
tv.setSelected(true);
 
Via the API:
 
Read more...