0

私はインフレータを使用していLinerLayoutます:

LayoutInflater inflater = LayoutInflater.from(this);
    mUILayout = (RelativeLayout) inflater.inflate(R.layout.camera_overlay,
            null, false);

それはうまくいっています。しかし、ユーザーが画面を回転させると、システムはlayout-land、同じ RelativeLayout を持つフォルダーから別のレイアウト xml ファイルを使用していますが、ScrollView 内にあります。では、両方の xml ファイルで同じになるようにコードを管理するにはどうすればよいでしょうか。

 private void addOverlayView(boolean initLayout)
{
    LayoutInflater inflater = LayoutInflater.from(this);
    View temp = inflater.inflate(R.layout.coupon, null);
    mUILayout = (RelativeLayout) temp.findViewById(R.id.testlayoutnew);
    mUILayout.setVisibility(View.VISIBLE);
    if (initLayout)
    {
        mUILayout.setBackgroundColor(Color.BLACK);
    }

    addContentView(mUILayout, new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT));

    mInstructionsView = mUILayout.findViewById(R.id.instructions);
    mInstructionsView.setVisibility(View.VISIBLE);

    mUILayout.bringToFront();
}
4

0 に答える 0