0

プログラムで作成された Viewgroup を parcelable に「変換」してから、この ViewGroup を送信して支援する方法はありますか?

それは良いデザインやパフォーマンスではないかもしれませんが、それを行う方法はありますか?

それが私のViewGroupの作成方法です:

public ViewGroup getViewGroup(){
        LinearLayout root = new LinearLayout(getContext());
        root.setPadding(getValueinPixels(16),getValueinPixels(16),getValueinPixels(16),getValueinPixels(16));
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        root.setLayoutParams(params);
        root.setOrientation(LinearLayout.VERTICAL);

        TextView message = new TextView(getContext());
        message.setText(getMessageCorrespondentToAction());
        message.setTextColor(Color.parseColor(getHexadecimalColorOfMessageView()));
        message.setPadding(getValueinPixels(0),getValueinPixels(8),getValueinPixels(0),getValueinPixels(8));

        TextView action = new TextView(getContext());
        action.setTextColor(Color.parseColor(getHexadecimalColorOfActionView()));
        action.setPadding(getValueinPixels(0),getValueinPixels(8),getValueinPixels(0),getValueinPixels(8));

        root.addView(message);
        root.addView(action);

        return root;

    } 
4

1 に答える 1