I am working on an android app in java, and ive created a sub-class of android.support.v7.widget.AppCompatButton, because youre not supposed to directly subclass Button. When i create the subclass object (hencforth refered to as "subButton") and add it to the activity via XML, the item looks and acts like a button, however when i do so via Java (programatically) , it looks and acts like a textView instead.
my XML is
<com.example.appName.subButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="xmlTestItem"/>
While my Java is
subButton testItem = new subButton(getApplicationContext());
testItem.setText("javaTestItem");
testItem.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT ,ViewGroup.LayoutParams.MATCH_PARENT));
mainListScroll.addView(testItem);
but it still only displays text instead of a button. Any clues?