More notes on layouts

Previous notes on layouts

This can be one of

visible: default
invisible: not visible but space taken
gone: no space is taken either

Use view.setVisibility(int) to control this programmatically

setvisibility api ref


private void hideEditField()
    {
    	TextView tv =
    		(TextView)this.findViewById(R.id.editText1);
    	tv.setVisibility(View.GONE);
    }

findviewbyid and nested components in an android layout?

Search for: findviewbyid and nested components in an android layout?

findviewbyid nested components null pointer

Search for: findviewbyid nested components null pointer

onfinishinflate

Search for: onfinishinflate

how to create a horizontal line in an Android layout?

Search for: how to create a horizontal line in an Android layout?


<ImageView android:src="@drawable/us2"
  android:layout_width="50dp"
  android:layout_height="50dp"/>

I was removing the child views programmatically and hence the view cannot be found. Haha...

So there is no problem with locating nested components with findviewbyid

how can i get rid of lingering keyboard in android?

Search for: how can i get rid of lingering keyboard in android?

android turn off keyboard shift focus

Search for: android turn off keyboard shift focus

here is a pertinent discussion on this

setsoftinputmode

Search for: setsoftinputmode

A link to the InputMethodManager

The input type method of a text field

please note this is a long document.

You are probably better of reading the java equivalent


private void hideKeyboard()
{
  InputMethodManager imm = 
    (InputMethodManager)getSystemService
	(Context.INPUT_METHOD_SERVICE);

  imm.hideSoftInputFromWindow(
      this.m_editText.getWindowToken(), 0);     
}

android text style capitalize

Search for: android text style capitalize

a quick look seem to yield no declarative solution