本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}