Android Hide ScrollBar in ScrollView

By default android comes with a scroll bar for scrolling across up and down , but in some specific application we may need to hide the scroll bar and still we should be able to scroll down. So far that kind of application here is the trickĀ  to hide the seek bar.

xml file

[sourcecode language="xml"]
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
<ScrollView android:id="@+id/ScrollView01"
android:layout_width="wrap_content" android:layout_height="100px">
<LinearLayout android:id="@+id/LinearLayout02"
android:layout_width="wrap_content" android:layout_height="wrap_content"
<Button android:id="@+id/Button01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="But1"></Button>
<Button android:id="@+id/Button02" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="But2"></Button>
<Button android:id="@+id/Button03" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="But3"></Button>

Java file

[sourcecode language="java"]
public class HideScrollBarExample extends Activity {

public void onCreate(Bundle icicle) {

ScrollView sView = (ScrollView)findViewById(R.id.ScrollView01);
// Hide the Scollbar

Android Hide Virtual Keyboard through code

In most situation we are in need to force close the keyboard by pressing the back button. But this can also be done using the following code.
[sourcecode language="java"]
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditTextName.getWindowToken(), 0);

This key code forces the keyboard to close.

Android Textview Tutorial

In this tutorial, we are going to learn about TextView.

In Android if we start any application, we may need to use TextView.

Textview is a View which we can add to any Layout.

How to add TextView in a Layout?

To add a textview to a layout, select the layout you need to add (here I have selected LinearLayout01) & then click the Add Button (shown in green color with plus symbol intimating "Adds a new element")

Hide the title bar in Android

When we develop a game or some other application, we may need to show a full page (screen) for users.

In the below image, theĀ Alarm Clock is the title showing in the title bar.

To remove this title bar we need to use,

[sourcecode language="java"]
public void onCreate(Bundle savedInstanceState) {

Syndicate content