当前位置: 首页>>代码示例>>Java>>正文


Java ScrollView.setFillViewport方法代码示例

本文整理汇总了Java中android.widget.ScrollView.setFillViewport方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollView.setFillViewport方法的具体用法?Java ScrollView.setFillViewport怎么用?Java ScrollView.setFillViewport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ScrollView的用法示例。


在下文中一共展示了ScrollView.setFillViewport方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createView

import android.widget.ScrollView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
    actionBar.setTitle(LocaleController.getString("AppName", R.string.AppName));
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == done_button) {
                views[currentViewNum].onNextPressed();
            } else if (id == -1) {
                finishFragment();
            }
        }
    });

    ActionBarMenu menu = actionBar.createMenu();
    doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));

    fragmentView = new ScrollView(context);
    ScrollView scrollView = (ScrollView) fragmentView;
    scrollView.setFillViewport(true);

    FrameLayout frameLayout = new FrameLayout(context);
    scrollView.addView(frameLayout, LayoutHelper.createScroll(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT));

    views[0] = new PhoneView(context);
    views[1] = new LoginActivitySmsView(context, 1);
    views[2] = new LoginActivitySmsView(context, 2);
    views[3] = new LoginActivitySmsView(context, 3);
    views[4] = new LoginActivitySmsView(context, 4);

    for (int a = 0; a < views.length; a++) {
        views[a].setVisibility(a == 0 ? View.VISIBLE : View.GONE);
        frameLayout.addView(views[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, a == 0 ? LayoutHelper.WRAP_CONTENT : LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, AndroidUtilities.isTablet() ? 26 : 18, 30, AndroidUtilities.isTablet() ? 26 : 18, 0));
        //LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 16, 30, 16, 0)
    }

    actionBar.setTitle(views[0].getHeaderName());
    FontManager.instance().setTypefaceImmediate(fragmentView);
    return fragmentView;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:42,代码来源:ChangePhoneActivity.java

示例2: createView

import android.widget.ScrollView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
    actionBar.setTitle(LocaleController.getString("AppName", R.string.AppName));

    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == done_button) {
                views[currentViewNum].onNextPressed();
            } else if (id == -1) {
                onBackPressed();
            }
        }
    });

    ActionBarMenu menu = actionBar.createMenu();
    doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));

    fragmentView = new ScrollView(context);
    ScrollView scrollView = (ScrollView) fragmentView;
    scrollView.setFillViewport(true);

    FrameLayout frameLayout = new FrameLayout(context);
    scrollView.addView(frameLayout, LayoutHelper.createScroll(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT));

    views[0] = new PhoneView(context);
    views[1] = new LoginActivitySmsView(context, 1);
    views[2] = new LoginActivitySmsView(context, 2);
    views[3] = new LoginActivitySmsView(context, 3);
    views[4] = new LoginActivitySmsView(context, 4);
    views[5] = new LoginActivityRegisterView(context);
    views[6] = new LoginActivityPasswordView(context);
    views[7] = new LoginActivityRecoverView(context);

    for (int a = 0; a < views.length; a++) {
        views[a].setVisibility(a == 0 ? View.VISIBLE : View.GONE);
        frameLayout.addView(views[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, a == 0 ? LayoutHelper.WRAP_CONTENT : LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, AndroidUtilities.isTablet() ? 26 : 18, 30, AndroidUtilities.isTablet() ? 26 : 18, 0));
    }

    Bundle savedInstanceState = loadCurrentState();
    if (savedInstanceState != null) {
        currentViewNum = savedInstanceState.getInt("currentViewNum", 0);
        if (currentViewNum >= 1 && currentViewNum <= 4) {
            int time = savedInstanceState.getInt("open");
            if (time != 0 && Math.abs(System.currentTimeMillis() / 1000 - time) >= 24 * 60 * 60) {
                currentViewNum = 0;
                savedInstanceState = null;
                clearCurrentState();
            }
        }
    }
    actionBar.setTitle(views[currentViewNum].getHeaderName());
    for (int a = 0; a < views.length; a++) {
        if (savedInstanceState != null) {
            if (a >= 1 && a <= 4) {
                if (a == currentViewNum) {
                    views[a].restoreStateParams(savedInstanceState);
                }
            } else {
                views[a].restoreStateParams(savedInstanceState);
            }
        }
        if (currentViewNum == a) {
            actionBar.setBackButtonImage(views[a].needBackButton() ? R.drawable.ic_ab_back : 0);
            views[a].setVisibility(View.VISIBLE);
            views[a].onShow();
            if (a == 3) {
                doneButton.setVisibility(View.GONE);
            }
        } else {
            views[a].setVisibility(View.GONE);
        }
    }
    FontManager.instance().setTypefaceImmediate(fragmentView);
    return fragmentView;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:77,代码来源:LoginActivity.java

示例3: createView

import android.widget.ScrollView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
    actionBar.setTitle(LocaleController.getString("AppName", R.string.AppName));
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == done_button) {
                views[currentViewNum].onNextPressed();
            } else if (id == -1) {
                finishFragment();
            }
        }
    });

    ActionBarMenu menu = actionBar.createMenu();
    //doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
    SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
    Drawable done = getParentActivity().getResources().getDrawable(R.drawable.ic_done);
    done.setColorFilter(themePrefs.getInt("prefHeaderIconsColor", 0xffffffff), PorterDuff.Mode.SRC_IN);
    doneButton = menu.addItemWithWidth(done_button, done, AndroidUtilities.dp(56));

    fragmentView = new ScrollView(context);
    ScrollView scrollView = (ScrollView) fragmentView;
    scrollView.setFillViewport(true);

    FrameLayout frameLayout = new FrameLayout(context);
    scrollView.addView(frameLayout, LayoutHelper.createScroll(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT));

    views[0] = new PhoneView(context);
    views[1] = new LoginActivitySmsView(context, 1);
    views[2] = new LoginActivitySmsView(context, 2);
    views[3] = new LoginActivitySmsView(context, 3);
    views[4] = new LoginActivitySmsView(context, 4);

    for (int a = 0; a < views.length; a++) {
        views[a].setVisibility(a == 0 ? View.VISIBLE : View.GONE);
        frameLayout.addView(views[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, a == 0 ? LayoutHelper.WRAP_CONTENT : LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, AndroidUtilities.isTablet() ? 26 : 18, 30, AndroidUtilities.isTablet() ? 26 : 18, 0));
        //LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 16, 30, 16, 0)
    }

    actionBar.setTitle(views[0].getHeaderName());

    return fragmentView;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:46,代码来源:ChangePhoneActivity.java

示例4: createView

import android.widget.ScrollView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
    actionBar.setTitle(LocaleController.getString("AppName", R.string.AppName));

    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == done_button) {
                views[currentViewNum].onNextPressed();
            } else if (id == -1) {
                onBackPressed();
            }
        }
    });

    ActionBarMenu menu = actionBar.createMenu();
    doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));

    fragmentView = new ScrollView(context);
    ScrollView scrollView = (ScrollView) fragmentView;
    scrollView.setFillViewport(true);

    FrameLayout frameLayout = new FrameLayout(context);
    scrollView.addView(frameLayout, LayoutHelper.createScroll(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT));

    views[0] = new PhoneView(context);
    views[1] = new LoginActivitySmsView(context, 1);
    views[2] = new LoginActivitySmsView(context, 2);
    views[3] = new LoginActivitySmsView(context, 3);
    views[4] = new LoginActivitySmsView(context, 4);
    views[5] = new LoginActivityRegisterView(context);
    views[6] = new LoginActivityPasswordView(context);
    views[7] = new LoginActivityRecoverView(context);
    views[8] = new LoginActivityResetWaitView(context);

    for (int a = 0; a < views.length; a++) {
        views[a].setVisibility(a == 0 ? View.VISIBLE : View.GONE);
        frameLayout.addView(views[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, a == 0 ? LayoutHelper.WRAP_CONTENT : LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, AndroidUtilities.isTablet() ? 26 : 18, 30, AndroidUtilities.isTablet() ? 26 : 18, 0));
    }

    Bundle savedInstanceState = loadCurrentState();
    if (savedInstanceState != null) {
        currentViewNum = savedInstanceState.getInt("currentViewNum", 0);
        if (currentViewNum >= 1 && currentViewNum <= 4) {
            int time = savedInstanceState.getInt("open");
            if (time != 0 && Math.abs(System.currentTimeMillis() / 1000 - time) >= 24 * 60 * 60) {
                currentViewNum = 0;
                savedInstanceState = null;
                clearCurrentState();
            }
        }
    }
    actionBar.setTitle(views[currentViewNum].getHeaderName());
    for (int a = 0; a < views.length; a++) {
        if (savedInstanceState != null) {
            if (a >= 1 && a <= 4) {
                if (a == currentViewNum) {
                    views[a].restoreStateParams(savedInstanceState);
                }
            } else {
                views[a].restoreStateParams(savedInstanceState);
            }
        }
        if (currentViewNum == a) {
            actionBar.setBackButtonImage(views[a].needBackButton() ? R.drawable.ic_ab_back : 0);
            views[a].setVisibility(View.VISIBLE);
            views[a].onShow();
            if (a == 3 || a == 8) {
                doneButton.setVisibility(View.GONE);
            }
        } else {
            views[a].setVisibility(View.GONE);
        }
    }

    return fragmentView;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:78,代码来源:LoginActivity.java


注:本文中的android.widget.ScrollView.setFillViewport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。