Discuz! Board

标题: 关于密码设置窗口 [打印本页]

作者: zangcf    时间: 2016-5-19 13:51
标题: 关于密码设置窗口
1,窗口如下:
  Window #4 Window{1ad5b301 u0 ChinaNet-7Xna}:
    mDisplayId=0 mSession=Session{3fc1d208 2418:1000} mClient=android.os.BinderProxy@7d230e8
    mOwnerUid=1000 mShowToOwnerOnly=true package=com.android.settings appop=NONE
    mAttrs=WM.LayoutParams{(0,0)(wrapxwrap) gr=#11 sim=#110 ty=2 fl=#1800002 pfl=0x8 fmt=-3 wanim=0x1030462 surfaceInsets=Rect(30, 30 - 30, 30)}
    Requested w=1056 h=337 mLayoutSeq=112
    mHasSurface=true mShownFrame=[0.0,23.0][960.0,296.0] isReadyForDisplay()=true
    WindowStateAnimator{23ab8f83 ChinaNet-7Xna}:
      mAnimating=false mLocalAnimating=false mAnimationIsEntrance=true mAnimation=null
      Surface: shown=true layer=21020 alpha=1.0 rect=(-30.0,-7.0) 1020.0 x 333.0

2,mAttrs=WM.LayoutParams{(0,0)(wrapxwrap) gr=#11 sim=#110 ty=2 fl=#1800002 pfl=0x8 fmt=-3 wanim=0x1030462 surfaceInsets=Rect(30, 30 - 30, 30)}来自如下地方:::
./base/core/java/android/view/WindowManager.java::::
        @Override
        public String toString() {
            StringBuilder sb = new StringBuilder(256);
            sb.append("WM.LayoutParams{");
            sb.append("(");
            sb.append(x);
            sb.append(',');
            sb.append(y);
            sb.append(")(");
            sb.append((width== MATCH_PARENT ?"fill"width==WRAP_CONTENT?"wrap":width)));
            sb.append('x');
            sb.append((height== MATCH_PARENT ?"fill"height==WRAP_CONTENT?"wrap":height)));
            sb.append(")");
            if (horizontalMargin != 0) {
                sb.append(" hm=");
                sb.append(horizontalMargin);
            }
            if (verticalMargin != 0) {
                sb.append(" vm=");
                sb.append(verticalMargin);
            }
            if (gravity != 0) {
                sb.append(" gr=#");
                sb.append(Integer.toHexString(gravity));
            }
            if (softInputMode != 0) {
                sb.append(" sim=#");
                sb.append(Integer.toHexString(softInputMode));
            }
            sb.append(" ty=");
            sb.append(type);
            sb.append(" fl=#");
            sb.append(Integer.toHexString(flags));
            if (privateFlags != 0) {
                if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
                    sb.append(" compatible=true");
                }
                sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
            }
            if (format != PixelFormat.OPAQUE) {
                sb.append(" fmt=");
                sb.append(format);
            }
            if (windowAnimations != 0) {
                sb.append(" wanim=0x");
                sb.append(Integer.toHexString(windowAnimations));
            }
            if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
                sb.append(" or=");
                sb.append(screenOrientation);
            }
            if (alpha != 1.0f) {
                sb.append(" alpha=");
                sb.append(alpha);
            }
            if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
                sb.append(" sbrt=");
                sb.append(screenBrightness);
            }
            if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
                sb.append(" bbrt=");
                sb.append(buttonBrightness);
            }
            if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
                sb.append(" rotAnim=");
                sb.append(rotationAnimation);
            }
            if (preferredRefreshRate != 0) {
                sb.append(" preferredRefreshRate=");
                sb.append(preferredRefreshRate);
            }
            if (systemUiVisibility != 0) {
                sb.append(" sysui=0x");
                sb.append(Integer.toHexString(systemUiVisibility));
            }
            if (subtreeSystemUiVisibility != 0) {
                sb.append(" vsysui=0x");
                sb.append(Integer.toHexString(subtreeSystemUiVisibility));
            }
            if (hasSystemUiListeners) {
                sb.append(" sysuil=");
                sb.append(hasSystemUiListeners);
            }
            if (inputFeatures != 0) {
                sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
            }
            if (userActivityTimeout >= 0) {
                sb.append(" userActivityTimeout=").append(userActivityTimeout);
            }
            if (!surfaceInsets.equals(Insets.NONE)) {
                sb.append(" surfaceInsets=").append(surfaceInsets);
            }

            sb.append('}');
            return sb.toString();
        }


说明这个窗口的属性mAttr的属性是WRAP_CONTENT



作者: zangcf    时间: 2016-5-19 13:52
这个窗口是哪里产生的,为何是WRAP_CONTENT的属性呢?
作者: zangcf    时间: 2016-5-19 13:53
先看看对于WRAP_CONTENT是如何计算其大小的?
作者: zangcf    时间: 2016-5-19 14:38
res/layout/alert_dialog_material.xml:::::
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/parentPanel"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    androidrientation="vertical">

    <LinearLayout android:id="@+id/topPanel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        androidrientation="vertical">
        <LinearLayout android:id="@+id/title_template"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            androidrientation="horizontal"
            android:gravity="center_vertical|start"
            android:paddingStart="@dimen/alert_dialog_padding_material"
            android:paddingEnd="@dimen/alert_dialog_padding_material"
            android:paddingTop="@dimen/alert_dialog_padding_top_material">
            <ImageView android:id="@+id/icon"
                android:layout_width="32dip"
                android:layout_height="32dip"
                android:layout_marginEnd="8dip"
                android:scaleType="fitCenter"
                android:src="@null" />
            <com.android.internal.widget.DialogTitle android:id="@+id/alertTitle"
                style="?attr/windowTitleStyle"
                android:singleLine="true"
                android:ellipsize="end"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAlignment="viewStart" />
        </LinearLayout>
        <!-- If the client uses a customTitle, it will be added here. -->
    </LinearLayout>

    <LinearLayout android:id="@+id/contentPanel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        androidrientation="vertical"
        android:minHeight="48dp">
        <ScrollView android:id="@+id/scrollView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clipToPadding="false">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                androidrientation="vertical">
                <TextView android:id="@+id/message"
                          style="@style/TextAppearance.Material.Subhead"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:paddingStart="@dimen/alert_dialog_padding_material"
                          android:paddingTop="@dimen/alert_dialog_padding_top_material"
                          android:paddingEnd="@dimen/alert_dialog_padding_material" />
                <Space android:id="@+id/textSpacerNoButtons"
                       android:visibility="gone"
                       android:layout_width="0dp"
                       android:layout_height="@dimen/alert_dialog_padding_top_material" />
            </LinearLayout>
        </ScrollView>
    </LinearLayout>

    <FrameLayout android:id="@+id/customPanel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:minHeight="48dp">
        <FrameLayout android:id="@+id/custom"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </FrameLayout>

    <LinearLayout android:id="@+id/buttonPanel"
        style="?attr/buttonBarStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layoutDirection="locale"
        androidrientation="horizontal"
        android:paddingStart="12dp"
        android:paddingEnd="12dp"
        android:paddingTop="8dp"
        android:paddingBottom="8dp">
        <Button android:id="@+id/button3"
            style="?attr/buttonBarNeutralButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <Space
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:visibility="invisible" />
        <Button android:id="@+id/button2"
            style="?attr/buttonBarNegativeButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <Button android:id="@+id/button1"
            style="?attr/buttonBarPositiveButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>
</LinearLayout>
作者: zangcf    时间: 2016-5-19 14:59
暂时删除如下部分,可以使用
        <!--Space
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:visibility="invisible" /-->




欢迎光临 Discuz! Board (http://47.89.242.157:9000/bbs/discuz/) Powered by Discuz! X3.2