レイアウトファイルには次のものがあります。
android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_marginRight="10dp"
android:text="SYN"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@drawable/rectanglepurple"
android:textColor="#000000"
android:gravity="right"/>
私はコードを使用して次のことを達成しようとしていますが、これまでのところ:
Resources res = getResources();
Drawable drawable1=res.getDrawable(R.drawable.rectanglepurple);
TextView idText = new TextView(getActivity());
idText.setText("SYN");
idText.setTextAppearance(getActivity(), android.R.style.TextAppearance_Medium);
idText.setTextColor(Color.BLACK);
idText.setGravity(Gravity.RIGHT);
idText.setBackgroundDrawable(drawable1);
対処方法がわからない
android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_marginRight="10dp"
助けていただければ幸いです。