Example usage for android.widget LinearLayout getChildAt

List of usage examples for android.widget LinearLayout getChildAt

Introduction

In this page you can find the example usage for android.widget LinearLayout getChildAt.

Prototype

public View getChildAt(int index) 

Source Link

Document

Returns the view at the specified position in the group.

Usage

From source file:com.cvte.LiZhiDemo.Activity.ImagePagerActivity.java

/**????    * @param 
 * @return/*  w  w  w  . j  a v  a  2s  .co  m*/
 */
private void initPoint(int picNum) {
    LinearLayout linearLayout = (LinearLayout) findViewById(R.id.point_layout);
    points = new ImageView[4];
    for (int i = 0; i < 4; i++) {

        points[i] = (ImageView) linearLayout.getChildAt(i);
        points[i].setEnabled(false);
        //??????                   //points[i].setOnClickListener(this);
        points[i].setTag(i);
    }
    for (int i = picNum; i < 4; i++) {
        points[i] = (ImageView) linearLayout.getChildAt(i);
        points[i].setVisibility(View.GONE);
    }

}

From source file:com.example.dany.jjdraw.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    drawView = (DrawingView) findViewById(R.id.drawing);
    LinearLayout paintLayout = (LinearLayout) findViewById(R.id.paint_colors);
    currPaint = (ImageButton) paintLayout.getChildAt(0);
    currPaint.setImageDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.paint_pressed, null));

    smallBrush = getResources().getInteger(R.integer.small_size);
    mediumBrush = getResources().getInteger(R.integer.medium_size);
    largeBrush = getResources().getInteger(R.integer.large_size);
    drawBtn = (ImageButton) findViewById(R.id.draw_btn);
    drawBtn.setOnClickListener(this);

    drawView.setBrushSize(mediumBrush);/*from   www  .  j a v  a2  s  .co m*/

    eraseBtn = (ImageButton) findViewById(R.id.erase_btn);
    eraseBtn.setOnClickListener(this);

    newBtn = (ImageButton) findViewById(R.id.new_btn);
    newBtn.setOnClickListener(this);

    saveBtn = (ImageButton) findViewById(R.id.save_btn);
    saveBtn.setOnClickListener(this);

    insertBtn = (ImageButton) findViewById(R.id.insert_btn);
    insertBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {

            Intent i = new Intent(Intent.ACTION_PICK,
                    android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

            startActivityForResult(i, RESULT_LOAD_IMAGE);
        }
    });

    undoBtn = (ImageButton) findViewById(R.id.undo_btn);
    undoBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!drawView.onClickUndo()) {
                Toast nothingToast = Toast.makeText(getApplicationContext(), "Nothing to Undo!",
                        Toast.LENGTH_SHORT);
                nothingToast.show();
            }
        }
    });

    redoBtn = (ImageButton) findViewById(R.id.redo_btn);
    redoBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!drawView.onClickRedo()) {
                Toast nothingToast = Toast.makeText(getApplicationContext(), "Nothing to Redo!",
                        Toast.LENGTH_SHORT);
                nothingToast.show();
            }
        }
    });

}

From source file:au.org.ala.fielddata.mobile.SurveyBuilder.java

public View buildFields(Attribute attribute, ViewGroup parent) {
    LinearLayout layout = (LinearLayout) viewContext.getLayoutInflater().inflate(R.layout.label_and_field,
            parent);/*www.j  a  v a 2  s . co m*/
    ViewGroup container = (ViewGroup) layout.getChildAt(0);
    buildLabel(attribute, container);
    viewContext.getLayoutInflater().inflate(R.layout.error_label, container).findViewById(R.id.errorLabel);
    View inputField = buildInput(attribute, container);

    return inputField;
}

From source file:com.menu.menus.ScreenSlideActivity.java

public void eliminaPlato(View v) {

    // Obtiene el padre del boton, la fila del plato
    LinearLayout fila = (LinearLayout) v.getParent();

    // Obtiene datos del plato mediante su fila y posicion
    TextView nombrePlato = (TextView) fila.getChildAt(1);
    TextView categoria = (TextView) fila.getChildAt(5);

    // Recoge el fragmento Comanda que esta siendo mostrado
    FragmentoComanda f = (FragmentoComanda) getSupportFragmentManager().findFragmentByTag("Comanda");

    // Eliminar plato seleccionado y establece la nueva estructura sin el plato
    platosSeleccionados.eliminarPlato(categoria.getText().toString(), nombrePlato.getText().toString());
    f.setPlatosSeleccionados(platosSeleccionados);

    // Limpia platos anteriores y muestra la nueva lista de platos
    f.limpiaPlatos();//from  w w  w.j  a  va2s .c  om
    f.muestraPlatos();

}

From source file:com.vrs.reqdroid.fragments.RequisitosFragment.java

/**
 * Abre a tela de detalhes do requisito selecionado.
 *//* w  w w . j  a  va2 s  .c  om*/
private void exibeDetalhesRequisito() {
    final Intent i = new Intent(getActivity(), TelaRequisitoDetalhadoActivity.class);

    lvRequisitos.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, final int position, long l) {
            LinearLayout caixaRequisito = (LinearLayout) view; //LinearLayout que contem o texto e botao
            final TextView txtRequisito = (TextView) caixaRequisito.getChildAt(0);
            requisitoSelecionado = txtRequisito.getText().toString();
            posicaoRequisitoSelecionado = position;
            startActivity(i);
        }
    });
}

From source file:com.vrs.reqdroid.fragments.RequisitosAtrasadosFragment.java

/**
 * Abre a tela de detalhes do requisito selecionado.
 *//*  w  w w .j a  va  2  s.  c  o  m*/
private void exibeDetalhesRequisito() {
    final Intent i = new Intent(getActivity(), TelaRequisitoAtrasadoDetalhadoActivity.class);

    lvRequisitosAtrasados.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, final int position, long l) {
            LinearLayout caixaRequisito = (LinearLayout) view; //LinearLayout que contem o texto e botao
            final TextView txtRequisito = (TextView) caixaRequisito.getChildAt(0);
            requisitoSelecionado = txtRequisito.getText().toString();
            posicaoRequisitoSelecionado = position;
            startActivity(i);
        }
    });
}

From source file:com.vrs.reqdroid.fragments.HipotesesFragment.java

/**
 * Abre a tela de detalhes da hipotese selecionada.
 *///from  w  w  w.  ja v  a 2  s.c o m
private void exibeDetalhesHipotese() {
    final Intent i = new Intent(getActivity(), TelaHipoteseDetalhadaActivity.class);

    lvHipoteses.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, final int position, long l) {
            LinearLayout caixaHipotese = (LinearLayout) view; //LinearLayout que contem o texto e botao
            final TextView txtHipotese = (TextView) caixaHipotese.getChildAt(0);
            hipoteseSelecionada = txtHipotese.getText().toString();
            posicaoHipoteseSelecionada = position;
            startActivity(i);
        }
    });
}

From source file:com.irccloud.android.activity.ShareChooserActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    countdownTimer = new Timer("share-chooser-countdown-timer");
    setTheme(ColorScheme.getDialogTheme(ColorScheme.getUserTheme()));
    ColorScheme.getInstance().setThemeFromContext(this, ColorScheme.getUserTheme());
    if (Build.VERSION.SDK_INT >= 21) {
        Bitmap cloud = BitmapFactory.decodeResource(getResources(), R.drawable.splash_logo);
        setTaskDescription(new ActivityManager.TaskDescription(getResources().getString(R.string.app_name),
                cloud, ColorScheme.getInstance().navBarColor));
        getWindow().setStatusBarColor(ColorScheme.getInstance().statusBarColor);
        getWindow().setNavigationBarColor(getResources().getColor(android.R.color.black));
    }/*ww  w  .jav  a  2s  .com*/
    getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_share_chooser);
    connecting = findViewById(R.id.connecting);
    errorMsg = findViewById(R.id.errorMsg);
    connectingMsg = findViewById(R.id.connectingMsg);
    progressBar = findViewById(R.id.connectingProgress);

    BuffersListFragment f = (BuffersListFragment) getSupportFragmentManager()
            .findFragmentById(R.id.BuffersList);
    f.readOnly = true;
    f.setSelectedBid(-2);
    buffersList = f.getView();
    buffersList.setVisibility(View.GONE);

    Typeface SourceSansProRegular = ResourcesCompat
            .getFont(IRCCloudApplication.getInstance().getApplicationContext(), R.font.sourcesansproregular);

    LinearLayout IRCCloud = findViewById(R.id.IRCCloud);
    for (int i = 0; i < IRCCloud.getChildCount(); i++) {
        View v = IRCCloud.getChildAt(i);
        if (v instanceof TextView) {
            ((TextView) v).setTypeface(SourceSansProRegular);
        }
    }

    conn = NetworkConnection.getInstance();
    conn.addHandler(this);
}

From source file:org.erlymon.monitor.ui.activity.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    MainApp.getAppComponent().inject(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ButterKnife.bind(this);

    setSupportActionBar(mToolbar);//  w ww  . jav  a 2  s .co m

    LinearLayout linearLayout = (LinearLayout) navigationView.getHeaderView(0);
    mLabelName = (TextView) linearLayout.getChildAt(1);
    mLabelEmail = (TextView) linearLayout.getChildAt(2);

    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, mToolbar,
            R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();

    navigationView.setNavigationItemSelectedListener(this);

    navigatorHolder.setNavigator(navigator);
    mGetServerPresenter.getServer();

    Timber.d("CURRENT USER: " + getIntent().getParcelableExtra("session"));
}

From source file:org.apps8os.motivator.ui.AddGoalActivity.java

/**
 * Actions for the menu items./* ww  w  .j a  va 2s  .  c  om*/
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.questions_add_comment) {
        AlertDialog.Builder alert = new AlertDialog.Builder(this);
        alert.setTitle(getString(R.string.name_the_event));
        // Create TextView
        LinearLayout rootElement = (LinearLayout) getLayoutInflater()
                .inflate(R.layout.element_comment_edit_text, null);
        final EditText input = (EditText) rootElement.getChildAt(0);
        input.setText(mName);
        alert.setView(rootElement);

        alert.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                mName = input.getText().toString();
                getActionBar().setTitle(mName);
            }
        });

        alert.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                // Canceled.
            }
        });
        alert.show();
        return true;
    } else {
        return super.onOptionsItemSelected(item);
    }
}