Ive been trying to create a text editor that has words suggestions turned on. This is what i have been doing hoping to get it to work but haven't had any such luck so far
EditText test = (EditText) new EditText(Page.this);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1);
params.setMargins(5, 0, 5, 0);
Alright i found out what is needed to be done your best bet is to use something called a layout inflator.
this is because there is a bunch of things set for a Edittext when done in xml. Create this(below) for your xml file. Note you can only have one Root elements. So you will need a new file for each template.
notice i have it with an id as well
use this(below) to insert programmatically
EditText Stest = (EditText) getLayoutInflater().inflate(R.layout.section_header, null); <?xml version="1.0" encoding="utf-8"?> <EditText xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:inputType="textAutoCorrect|textCapWords" android:id="@+id/section" > </EditText>
this way it will insert and have all the default plus whatever additions you have created. In truth there is lack of support for doing things code base because most uses the XML.
this way you can still us code for dynamic insertion but use xml to define how the inserted object/view will behave