Skip to main content

Posts

Showing posts with the label textview

Customized Spinners in Android

See more basics on Android along with interview questions The Android Spinner Control is definitely the equivalent of the drop-down selector . By making use of spinner control you basically obtain the capability to choose from a list without taking up all of the display screen space of a ListView. Spinners provide a quick way to select one value from a set. In the default state, a spinner shows its currently selected value. Touching the spinner displays a dropdown menu with all other available values, from which the user can select a new one. You can add a spinner to your layout with the Spinner object. You should usually do so in your xml layout with a  <spinner>   element. For example: <Spinner     android:id="@+id/myspinner"     android:layout_width="fill_parent"     android:layout_height="wrap_content" /> Also See....Simple Spinners In Android Here we are going to deal with Customized Spinners.Her...

Falling Animation in ANDROID using Animation of Translate

Falling animation is used to bring transition to a view between two X points or two Y points. In Android, you can apply this scaling effect to almost anything, from simple text, to images, buttons, etc… in res/anim/falling.xml suppose if transition to be done between two different X indexes use.. <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <translate android:fromXDelta="-100%p" android:toXDelta="0" android:duration="2000"/> </set> suppose if transition to be done between two different Y indexes use.. <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <translate android:fr...

Scaling Animation In ANDROID

Scaling animation is used to scale a view. In Android, you can apply this scaling effect to almost anything, from simple text, to images, buttons, etc…  Here simply I will explain a scaling textview which you can apply to other views also... In res/anim/scale.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <scale android:fromXScale="0.0" android:toXScale="1.0" android:fromYScale="0.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:duration="2000" /> </set> Java source code is given below public class Textviewanimation extends Activity { Animation fadeIn,fadeOut; TextView tv; Button startanimation; @Override public void onCreate(Bundle savedInstanceState) ...

TextView Animation or Alpha animation (FadeIn , FadeOut) in ANDROID

An Alpha Animation is animation that controls the alpha level of an object, i.e. fading it in and out. In Android, you can apply that fading effect to almost anything, from simple text, to images, buttons, check boxes, etc…   This can be done both from xml and from java class. Here I will explain a simple way to give a FadeIn and FadeOut for a textview on button click.. public class Textviewanimation extends Activity { Animation fadeIn,fadeOut; TextView tv; Button startanimation; Boolean fadeflag=true; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_textviewanimation); tv=(TextView) findViewById(R.id.textview); startanimation=(Button) findViewById(R.id.button1); fadeIn = new AlphaAnimation(0.0f , 1.0f ) ; fadeIn.setDuration(1200); fadeIn.setFillAfter(true); fadeOut = new AlphaAnimation(1.0f , 0.0f); fadeO...

Simple AutoComplete TextView in ANDROID

public class Autocomplete extends Activity { String name[]={ "John", "Angel", "Mark", "Angelina", "Jhony", "Juli", "Augustine", "Robert", "Reena", "Ancilina", "Mary", "Juliet" }; AutoCompleteTextView autotextview; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_autocomplete); autotextview=(AutoCompleteTextView) findViewById(R.id.myautocomplete); autotextview.setAdapter(new ArrayAdapter<string>(this, android.R.layout.simple_dropdown_item_1line, name)); }

TextView with link in ANDROID…….

in java class: import android.app.Activity; import android.os.Bundle; import android.text.Html; import android.text.method.LinkMovementMethod; import android.widget.TextView; public class TextViewLinkDemo extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView tv = (TextView) findViewById(R.id.tv); tv.setText( Html.fromHtml(" This is a textView with a link " +" AngelMark Blog " + "created in the Java source code using HTML.")); tv.setMovementMethod(LinkMovementMethod.getInstance()); } } main.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width=...

Android – Bullets in ListView

main.xml : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="10dp"> <ListView android:id="@+id/listView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:listSelector="@android:color/transparent" android:divider="@null"/> </LinearLayout> create a bullet.xml in drawable folder: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <size android:height="6dp" android:width="6dp"/> ...

Spinners in Android

The Android Spinner Control is definitely the equivalent of the drop-down selector . By making use of spinner control you basically obtain the capability to choose from a list without taking up all of the display screen space of a ListView. Spinners provide a quick way to select one value from a set. In the default state, a spinner shows its currently selected value. Touching the spinner displays a dropdown menu with all other available values, from which the user can select a new one. You can add a spinner to your layout with the Spinner object. You should usually do so in your xml layout with a  <spinner>   element. For example: <Spinner             android:id="@+id/myspinner"            android:layout_width="fill_parent"         android:layout_height="wrap_content" /> Also See....Custom Spinners In Android Her...

Blinking TextView - Two Methods

METHOD 1 private void blink(){ final Handler handler = new Handler(); new Thread(new Runnable() { public void run() { int timeToBlink = 600; //in milissegunds try { Thread.sleep(timeToBlink); }catch (Exception e) { }handler.post(new Runnable() { public void run() { TextView txt = (TextView)findViewById(R.id.usage); if(txt.getVisibility() == View.VISIBLE) { txt.setVisibility(View.INVISIBLE); }else { txt.setVisibility(View.VISIBLE); } blink(); } }); } }).start(); } METHOD 2 T...