Sat. Apr 27th, 2024
package androiindians.helloworld

import android.os.Bundle;
import android.app.Activity;
import android.widget.LinearLayout;
import android.widget.TextView;
public class MainActivity extends Activity {
    LinearLayout ll;

    TextView[] tv;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ll = new LinearLayout(MainActivity.this);
       // ll.setOrientation(LinearLayout.VERTICAL);    // Vertical
        ll.setOrientation(LinearLayout.HORIZONTAL);    // Horizontal
        tv = new TextView[7];
        for(int i=1;i<tv.length;i++)
        {
            tv[i] = new TextView(MainActivity.this);
            tv[i].setText("Text "+i);
            tv[i].setTextSize(25);
            tv[i].setPadding(50, 20, 0, 10);
            ll.addView(tv[i]);
        }
        setContentView(ll);
    }
}

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 *