Sat. Nov 23rd, 2024
package androiindians.helloworld;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.InputType;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
    TableLayout TL;
    TableRow tr1, tr2, tr3;
    TextView t1, t2, dummy;
    EditText et1, et2;
    Button login;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TL = new TableLayout(MainActivity.this);
        tr1 = new TableRow(MainActivity.this);
        tr2 = new TableRow(MainActivity.this);

        tr3 = new TableRow(MainActivity.this);
        t1 = new TextView(MainActivity.this);
        t2 = new TextView(MainActivity.this);
        dummy = new TextView(MainActivity.this);
        et1 = new EditText(MainActivity.this);
        et2 = new EditText(MainActivity.this);
        login = new Button(MainActivity.this);
        t1.setText("Username");
        t1.setTextSize(15);
        t1.setPadding(20, 20, 20, 20);
        tr1.addView(t1);
        et1.setHint("Enter Username");
        et1.setTextSize(15);
        et1.setPadding(20, 20, 20, 20);
        tr1.addView(et1);
        t2.setText("Password");
        t2.setTextSize(15);
        t2.setPadding(20, 20, 20, 20);
        tr2.addView(t2);
        et2.setHint("Enter Password");
        et2.setTextSize(15);
        et2.setPadding(20, 20, 20, 20);
        et2.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
        tr2.addView(et2);
        tr3.addView(dummy);
        login.setText("Username");
        login.setTextSize(15);
        login.setPadding(20, 20, 20, 20);
        tr3.addView(login);
        TL.addView(tr1);
        TL.addView(tr2);
        TL.addView(tr3);
        setContentView(TL);      
    }
}

By Rajashekar

I’m (Rajashekar) a core Android developer with complimenting skills as a web developer from India. I cherish taking up complex problems and turning them into beautiful interfaces. My love for decrypting the logic and structure of coding keeps me pushing towards writing elegant and proficient code, whether it is Android, PHP, Flutter or any other platforms. You would find me involved in cuisines, reading, travelling during my leisure hours.

Leave a Reply

Your email address will not be published. Required fields are marked *