viernes, 21 de febrero de 2014

Android - First Step II

Create a ScrollView

This view create a scroll in all he view. In activity_main.xml file start with the tag <ScrollView>. Inside the tag <ScrollView> must be another Layout tag

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:fillViewport="true"
    tools:context=".MainActivity" >


     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:orientation="vertical" >


    </LinearLayout>

</ScrollView>



Event after text change in EditText

After get the EditText element, as the following code:
mComment = (EditText) findViewById(R.id.comments);

Create a TextWatcher object, that is the responsible of expose link to the event.
TextWatcher watcher = new TextWatcher() {
           
            @Override
            public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
                // TODO Auto-generated method stub
               
            }
           
            @Override
            public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
                    int arg3) {
                // TODO Auto-generated method stub
               
            }
           
            @Override
            public void afterTextChanged(Editable arg0) {
                // TODO Auto-generated method stub
               
            }
        };



No hay comentarios:

Publicar un comentario