So verschieben Sie eine layout-Inhalt außerhalb des Bildschirms android

Muss ich verschieben Sie den Inhalt des Bildschirms auf der linken Seite, so kann ich Platz machen für das slide-Menü auf der rechten Seite
So verschieben Sie eine layout-Inhalt außerhalb des Bildschirms android

Hier ist der code:

//modify content layout params
    try {
        content = ((LinearLayout) act.findViewById(android.R.id.content)
                .getParent());
    } catch (ClassCastException e) {
        /*
         * When there is no title bar
         * (android:theme="@android:style/Theme.NoTitleBar"), the
         * android.R.id.content FrameLayout is directly attached to the
         * DecorView, without the intermediate LinearLayout that holds the
         * titlebar plus content.
         */
        content = (FrameLayout) act.findViewById(android.R.id.content);
    }
FrameLayout.LayoutParams pr = (android.widget.FrameLayout.LayoutParams) content
                    .getLayoutParams();
            pr.rightMargin = menuSize;
            content.setLayoutParams(pr);
//add the slide menu to parent
    parent = (FrameLayout) content.getParent();

    try {
        parent = (FrameLayout) content.getParent();
    } catch (ClassCastException e) {
        /*
         * Most probably a LinearLayout, at least on Galaxy S3.
         */
        LinearLayout realParent = (LinearLayout) content.getParent();
        parent = new FrameLayout(act);
        realParent.addView(parent, 0); //add FrameLayout to real parent of
                                        //content
        realParent.removeView(content); //remove content from real parent
        parent.addView(content); //add content to FrameLayout
    }

    LayoutInflater inflater = (LayoutInflater) act
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    menu = inflater.inflate(R.layout.slidemenu, null);

    FrameLayout.LayoutParams lays = new FrameLayout.LayoutParams(menuSize,
            FrameLayout.LayoutParams.MATCH_PARENT, Gravity.RIGHT);
    lays.setMargins(0, statusHeight, 0, 0);
    menu.setLayoutParams(lays);
    parent.addView(menu);

aber was ich bekomme ist:
So verschieben Sie eine layout-Inhalt außerhalb des Bildschirms android
der Inhalt ist nur in der Größe verändert, um den Bildschirm passen, wie kann ich diese Arbeit machen?
Btw, ich kann den Inhalt ändern das layout Ihrer relativen Anordnung mit einer surfaceview, aber es sollte funktionieren mit allen layouts ändern, weil ich die DecorView wich ist die Ansicht von oben, Behälter

InformationsquelleAutor user924941 | 2013-01-22
Schreibe einen Kommentar