Search in sources :

Example 76 with Button

use of android.widget.Button in project platform_frameworks_base by android.

the class DialogActivity method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mLayout = new LinearLayout(this);
    mLayout.setOrientation(LinearLayout.VERTICAL);
    mLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    mButton1 = new Button(this);
    //(R.string.open_dialog_scrollable);
    mButton1.setText("Dialog WITHOUT EditText");
    mButton1.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            showDialog(DIALOG_WITHOUT_EDITTEXT);
        }
    });
    mButton2 = new Button(this);
    //(R.string.open_dialog_nonscrollable);
    mButton2.setText("Dialog WITH EditText");
    mButton2.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            showDialog(DIALOG_WITH_EDITTEXT);
        }
    });
    mEditText = new EditText(this);
    mLayout.addView(mEditText);
    mLayout.addView(mButton1);
    mLayout.addView(mButton2);
    setContentView(mLayout);
}
Also used : EditText(android.widget.EditText) Button(android.widget.Button) ViewGroup(android.view.ViewGroup) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 77 with Button

use of android.widget.Button in project platform_frameworks_base by android.

the class DisplayListLayersActivity method createButton.

private Button createButton(final LinearLayout root) {
    Button button = new Button(this);
    button.setText("Invalidate");
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            for (int i = 0; i < root.getChildCount(); i++) {
                View child = root.getChildAt(i);
                if (child != v) {
                    child.invalidate();
                }
            }
        }
    });
    return button;
}
Also used : Button(android.widget.Button) View(android.view.View)

Example 78 with Button

use of android.widget.Button in project androidannotations by androidannotations.

the class TouchesHandledActivityTest method buttonArgumentIsGiven.

@Test
public void buttonArgumentIsGiven() {
    assertThat(activity.viewArgument).isNull();
    Button button = (Button) activity.findViewById(R.id.buttonWithButtonArgument);
    button.dispatchTouchEvent(mockedEvent);
    assertThat(activity.viewArgument).isSameAs(button);
}
Also used : Button(android.widget.Button) Test(org.junit.Test)

Example 79 with Button

use of android.widget.Button in project androidannotations by androidannotations.

the class LongClicksHandledActivityTest method buttonArgumentIsGiven.

@Test
public void buttonArgumentIsGiven() {
    assertThat(activity.viewArgument).isNull();
    Button button = (Button) activity.findViewById(R.id.buttonWithButtonArgument);
    button.performLongClick();
    assertThat(activity.viewArgument).isSameAs(button);
}
Also used : Button(android.widget.Button) Test(org.junit.Test)

Example 80 with Button

use of android.widget.Button in project platform_frameworks_base by android.

the class BiDiTestGridLayoutCodeRtl method create.

public static View create(Context context) {
    GridLayout layout = new GridLayout(context);
    layout.setUseDefaultMargins(true);
    layout.setAlignmentMode(ALIGN_BOUNDS);
    layout.setRowOrderPreserved(false);
    layout.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
    Spec row1 = spec(0);
    Spec row2 = spec(1);
    Spec row3 = spec(2, BASELINE);
    Spec row4 = spec(3, BASELINE);
    // allow the last two rows to overlap the middle two
    Spec row5 = spec(2, 3, FILL);
    Spec row6 = spec(5);
    Spec row7 = spec(6);
    Spec col1a = spec(0, 4, CENTER);
    Spec col1b = spec(0, 4, LEFT);
    Spec col1c = spec(0, RIGHT);
    Spec col2 = spec(1, START);
    Spec col3 = spec(2, FILL);
    Spec col4a = spec(3);
    Spec col4b = spec(3, FILL);
    {
        TextView c = new TextView(context);
        c.setTextSize(32);
        c.setText("Email setup");
        layout.addView(c, new GridLayout.LayoutParams(row1, col1a));
    }
    {
        TextView c = new TextView(context);
        c.setTextSize(16);
        c.setText("You can configure email in just a few steps:");
        layout.addView(c, new GridLayout.LayoutParams(row2, col1b));
    }
    {
        TextView c = new TextView(context);
        c.setText("Email address:");
        layout.addView(c, new GridLayout.LayoutParams(row3, col1c));
    }
    {
        EditText c = new EditText(context);
        c.setEms(10);
        c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
        layout.addView(c, new GridLayout.LayoutParams(row3, col2));
    }
    {
        TextView c = new TextView(context);
        c.setText("Password:");
        layout.addView(c, new GridLayout.LayoutParams(row4, col1c));
    }
    {
        TextView c = new EditText(context);
        c.setEms(8);
        c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PASSWORD);
        layout.addView(c, new GridLayout.LayoutParams(row4, col2));
    }
    {
        Space c = new Space(context);
        layout.addView(c, new GridLayout.LayoutParams(row5, col3));
    }
    {
        Button c = new Button(context);
        c.setText("Manual setup");
        layout.addView(c, new GridLayout.LayoutParams(row6, col4a));
    }
    {
        Button c = new Button(context);
        c.setText("Next");
        layout.addView(c, new GridLayout.LayoutParams(row7, col4b));
    }
    return layout;
}
Also used : EditText(android.widget.EditText) Space(android.widget.Space) GridLayout(android.widget.GridLayout) Button(android.widget.Button) TextView(android.widget.TextView) Spec(android.widget.GridLayout.Spec)

Aggregations

Button (android.widget.Button)1477 View (android.view.View)909 TextView (android.widget.TextView)609 OnClickListener (android.view.View.OnClickListener)275 Intent (android.content.Intent)200 LinearLayout (android.widget.LinearLayout)189 ImageView (android.widget.ImageView)146 EditText (android.widget.EditText)126 ListView (android.widget.ListView)112 AdapterView (android.widget.AdapterView)76 ViewGroup (android.view.ViewGroup)65 LayoutInflater (android.view.LayoutInflater)56 CompoundButton (android.widget.CompoundButton)53 ScrollView (android.widget.ScrollView)53 Test (org.junit.Test)51 Bundle (android.os.Bundle)49 CheckBox (android.widget.CheckBox)48 FrameLayout (android.widget.FrameLayout)47 AlertDialog (android.app.AlertDialog)45 ImageButton (android.widget.ImageButton)45