Java Code Examples for android.widget.ScrollView#findViewById()
The following examples show how to use
android.widget.ScrollView#findViewById() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FragmentBase.java From FairEmail with GNU General Public License v3.0 | 6 votes |
private void scrollTo() { if (scrollTo == 0) return; View view = getView(); if (view == null) return; final ScrollView scroll = view.findViewById(R.id.scroll); if (scroll == null) return; final View child = scroll.findViewById(scrollTo); if (child == null) return; scrollTo = 0; scroll.post(new Runnable() { @Override public void run() { scroll.scrollTo(0, child.getTop()); } }); }
Example 2
Source File: ViewPosition.java From show-case-card-view with Apache License 2.0 | 6 votes |
@Nullable @Override public Point getScrollPosition(@Nullable ScrollView scrollView) { if (scrollView == null || scrollView.findViewById(view.getId()) == null) { // scrollview not set, or child is not part of the scrollview content: do not scroll. return null; } // get the top of the item relative to the ScrollView: Rect offsetViewBounds = new Rect(); view.getDrawingRect(offsetViewBounds); scrollView.offsetDescendantRectToMyCoords(view, offsetViewBounds); int relativeTop = offsetViewBounds.top; // put the item in the middle of the screen: int scrollToY = relativeTop - (scrollView.getHeight() / 2); if (scrollToY < 0) { scrollToY = 0; } return new Point(scrollView.getScrollX(), scrollToY); }
Example 3
Source File: IconicFontEngineIconsFragment.java From android-IconicFontEngine with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ScrollView rootView = (ScrollView) inflater.inflate(R.layout.iconic_font_engine_icons_fragment, container, false); LinearLayout iconicContainer = (LinearLayout) rootView.findViewById(R.id.iconic_container); int enginePosition = getArguments().getInt(ENGINE_POSITION); IconicFontEngine engine = IconicFontEngine.getDefaultEngines().get(enginePosition); int position = 0; for (String iconName: engine.getIconicFontMap().allNames()) { LinearLayout view = (LinearLayout) inflater.inflate(R.layout.iconic_view_layout, container, false); IconicFontTextView tv = (IconicFontTextView) view.findViewById(R.id.iconic_font_text_view); tv.setText("{" + iconName + "} " + iconName); view.setBackgroundResource(position % 2 == 0 ? R.color.background_even : R.color.background_odd); iconicContainer.addView(view); position++; } return rootView; }
Example 4
Source File: FirstTimeUseDialog.java From talkback with Apache License 2.0 | 6 votes |
@Override public View getCustomizedView() { LayoutInflater inflater = LayoutInflater.from(context); final ScrollView root = (ScrollView) inflater.inflate(R.layout.first_time_use_dialog, null); checkBox = root.findViewById(R.id.show_message_checkbox); final TextView mainContent = root.findViewById(R.id.dialog_content); checkBox.setText(checkboxTextResId); mainContent.setText(dialogMainMessageResId); // Customize dialog content and set text view visible. final TextView secondContent = root.findViewById(R.id.dialog_second_content); final TextView thirdContent = root.findViewById(R.id.dialog_third_content); if (dialogSecondMessageResId != INVALID_RES_ID) { secondContent.setVisibility(View.VISIBLE); secondContent.setText(dialogSecondMessageResId); } if (dialogThirdMessageResId != INVALID_RES_ID) { thirdContent.setVisibility(View.VISIBLE); thirdContent.setText(dialogThirdMessageResId); } return root; }
Example 5
Source File: RootNameserverFragment.java From DNSHero with GNU General Public License v3.0 | 5 votes |
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { ScrollView layout = (ScrollView) inflater.inflate(R.layout.fragment_root_nameserver, container, false); Bundle args = getArguments(); Domain.RootNameserver root; if (getContext() == null || args == null || (root = (Domain.RootNameserver) args.getSerializable("root")) == null) return null; SuperTextView name = layout.findViewById(R.id.rootNsFragment_name); Utils.clickToCopy(name); name.setText(root.name); SuperTextView rtt = layout.findViewById(R.id.rootNsFragment_rtt); rtt.setHtml(R.string.rtt, Utils.formatRTT(root.rtt)); final LinearLayout nameservers = layout.findViewById(R.id.rootNsFragment_nameservers); for (String nameserver : root.nameservers) { TextView text = (TextView) inflater.inflate(R.layout.item_secondary_text, nameservers, false); text.setText(nameserver); Utils.clickToCopy(text); nameservers.addView(text); } final ImageButton toggleNs = layout.findViewById(R.id.rootNsFragment_toggleNs); toggleNs.setOnClickListener(v -> CommonUtils.handleCollapseClick(toggleNs, nameservers)); GlueView glue = layout.findViewById(R.id.rootNsFragment_glue); glue.setGlue(root.glue); return layout; }
Example 6
Source File: ExifInfoFragment.java From glimmr with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mLayout = (ScrollView) inflater.inflate( R.layout.exif_info_fragment, container, false); mTextViewErrorMessage = (TextView) mLayout.findViewById(R.id.textViewErrorMessage); setHasOptionsMenu(false); return mLayout; }
Example 7
Source File: PlaybackFragment.java From cwac-mediarouter with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { scroll= (ScrollView)inflater.inflate(R.layout.activity_main, container, false); transcript=(TextView)scroll.findViewById(R.id.transcript); logToTranscript("Started"); return(scroll); }
Example 8
Source File: ScrollViewSimpleFragment.java From StickyHeaderViewPager with Apache License 2.0 | 5 votes |
@Override public void bindData() { ScrollView scrollView = getScrollView(); LinearLayout linearLayout = (LinearLayout)scrollView.findViewById(R.id.ly_content); TextView tv_title = (TextView)scrollView.findViewById(R.id.tv_title); tv_title.setText("沁园春·雪"); TextView tv_data = (TextView)scrollView.findViewById(R.id.tv_data); tv_data.setText("北国风光\n" + "千里冰封\n" + "万里雪飘\n" + "望长城内外\n" + "惟余莽莽\n" + "大河上下\n" + "顿失滔滔\n" + "山舞银蛇\n" + "原驰蜡象\n" + "欲与天公试比高\n" + "须晴日\n" + "看红装素裹\n" + "分外妖娆\n" + "\n" + "江山如此多娇\n" + "引无数英雄竞折腰\n" + "惜秦皇汉武\n" + "略输文采\n" + "唐宗宋祖\n" + "稍逊风骚\n" + "一代天骄\n" + "成吉思汗\n" + "只识弯弓射大雕\n" + "俱往矣\n" + "数风流人物\n" + "还看今朝"); if(callBack != null){ callBack.bindData(); } }
Example 9
Source File: SettingActivity.java From sensordatacollector with GNU General Public License v2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // init view ViewGroup root = (ViewGroup) findViewById(android.R.id.content); ScrollView toolbarContainer = (ScrollView) View.inflate(this, R.layout.preferences, null); root.removeAllViews(); root.addView(toolbarContainer); // init toolbar Toolbar mToolBar = (Toolbar) toolbarContainer.findViewById(R.id.pref_toolbar); mToolBar.setTitle(getTitle()); mToolBar.setNavigationIcon(android.R.drawable.ic_menu_revert); //TODO mToolBar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); // start transaction getFragmentManager().beginTransaction().replace(R.id.pref_content_frame, new Prefs1Fragment()).commit(); }
Example 10
Source File: Dialogs.java From PretendYoureXyzzyAndroid with GNU General Public License v3.0 | 5 votes |
@NonNull @SuppressLint("InflateParams") public static MaterialAlertDialogBuilder gameOptions(@NonNull Context context, @NonNull Game.Options options, @NonNull FirstLoad firstLoad) { ScrollView layout = (ScrollView) LayoutInflater.from(context).inflate(R.layout.dialog_game_options, null, false); SuperTextView scoreLimit = layout.findViewById(R.id.gameOptions_scoreLimit); scoreLimit.setHtml(R.string.scoreLimit, options.scoreLimit); SuperTextView playerLimit = layout.findViewById(R.id.gameOptions_playerLimit); playerLimit.setHtml(R.string.playerLimit, options.playersLimit); SuperTextView spectatorLimit = layout.findViewById(R.id.gameOptions_spectatorLimit); spectatorLimit.setHtml(R.string.spectatorLimit, options.spectatorsLimit); SuperTextView timerMultiplier = layout.findViewById(R.id.gameOptions_timerMultiplier); timerMultiplier.setHtml(R.string.timerMultiplier, options.timerMultiplier); SuperTextView cardSets = layout.findViewById(R.id.gameOptions_cardSets); cardSets.setHtml(R.string.cardSets, options.cardSets.isEmpty() ? "<i>none</i>" : CommonUtils.join(firstLoad.createCardSetNamesList(options.cardSets), ", ")); SuperTextView blankCards = layout.findViewById(R.id.gameOptions_blankCards); blankCards.setHtml(R.string.blankCards, options.blanksLimit); SuperTextView password = layout.findViewById(R.id.gameOptions_password); if (options.password == null || options.password.isEmpty()) password.setVisibility(View.GONE); else password.setHtml(R.string.password, options.password); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); builder.setTitle(R.string.gameOptions) .setView(layout) .setPositiveButton(android.R.string.ok, null); return builder; }
Example 11
Source File: AuthenticationFragment.java From Aria2App with GNU General Public License v3.0 | 5 votes |
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { layout = (ScrollView) inflater.inflate(R.layout.fragment_edit_profile_authentication, container, false); authMethod = layout.findViewById(R.id.editProfile_authenticationMethod); authMethod.addOnButtonCheckedListener((group, checkedId, isChecked) -> { if (!isChecked) return; switch (checkedId) { default: case R.id.editProfile_authMethod_none: token.setVisibility(View.GONE); userAndPasswd.setVisibility(View.GONE); break; case R.id.editProfile_authMethod_token: token.setVisibility(View.VISIBLE); userAndPasswd.setVisibility(View.GONE); break; case R.id.editProfile_authMethod_http: token.setVisibility(View.GONE); userAndPasswd.setVisibility(View.VISIBLE); break; } }); token = layout.findViewById(R.id.editProfile_token); CommonUtils.clearErrorOnEdit(token); userAndPasswd = layout.findViewById(R.id.editProfile_userAndPasswd); username = layout.findViewById(R.id.editProfile_username); CommonUtils.clearErrorOnEdit(username); password = layout.findViewById(R.id.editProfile_password); CommonUtils.clearErrorOnEdit(password); return layout; }
Example 12
Source File: InsertHelper.java From ForPDA with GNU General Public License v3.0 | 4 votes |
public InsertHelper(Context context) { this.context = context; this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); layoutContainer = (ScrollView) inflater.inflate(R.layout.insert_helper_body, null); itemsContainer = (LinearLayout) layoutContainer.findViewById(R.id.insert_helper_items_container); }
Example 13
Source File: AutohideFragment.java From Dashchan with Apache License 2.0 | 4 votes |
@SuppressLint("InflateParams") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ScrollView view = (ScrollView) LayoutInflater.from(getActivity()).inflate(R.layout.dialog_autohide, null); scrollView = view; chanNameSelector = view.findViewById(R.id.chan_name); boardNameEdit = view.findViewById(R.id.board_name); threadNumberEdit = view.findViewById(R.id.thread_number); autohideOriginalPost = view.findViewById(R.id.autohide_original_post); autohideSage = view.findViewById(R.id.autohide_sage); autohideSubject = view.findViewById(R.id.autohide_subject); autohideComment = view.findViewById(R.id.autohide_comment); autohideName = view.findViewById(R.id.autohide_name); valueEdit = view.findViewById(R.id.value); errorText = view.findViewById(R.id.error_text); matcherText = view.findViewById(R.id.matcher_result); testStringEdit = view.findViewById(R.id.test_string); valueEdit.addTextChangedListener(valueListener); testStringEdit.addTextChangedListener(testStringListener); chanNameSelector.setOnClickListener(this); Collection<String> chanNames = ChanManager.getInstance().getAvailableChanNames(); if (chanNames.size() <= 1) { chanNameSelector.setVisibility(View.GONE); } AutohideStorage.AutohideItem autohideItem = null; if (savedInstanceState != null) { autohideItem = savedInstanceState.getParcelable(EXTRA_ITEM); } if (autohideItem == null) { autohideItem = getArguments().getParcelable(EXTRA_ITEM); } if (autohideItem != null) { if (autohideItem.chanNames != null) { selectedChanNames.addAll(autohideItem.chanNames); } updateSelectedText(); boardNameEdit.setText(autohideItem.boardName); threadNumberEdit.setText(autohideItem.threadNumber); autohideOriginalPost.setChecked(autohideItem.optionOriginalPost); autohideSage.setChecked(autohideItem.optionSage); autohideSubject.setChecked(autohideItem.optionSubject); autohideComment.setChecked(autohideItem.optionComment); autohideName.setChecked(autohideItem.optionName); valueEdit.setText(autohideItem.value); } else { chanNameSelector.setText(R.string.text_all_forums); boardNameEdit.setText(null); threadNumberEdit.setText(null); autohideOriginalPost.setChecked(false); autohideSage.setChecked(false); autohideSubject.setChecked(true); autohideComment.setChecked(true); autohideName.setChecked(true); valueEdit.setText(null); } updateTestResult(); }
Example 14
Source File: SettingsFragment.java From Anti-recall with GNU Affero General Public License v3.0 | 4 votes |
private void initPermissionCheck(ScrollView view) { // 跳转 View btnAccessibilityService = view.findViewById(R.id.btn_navigate_accessibility_service); View btnNotificationListener = view.findViewById(R.id.btn_navigate_notification_listener); View btnOverlays = view.findViewById(R.id.btn_navigate_overlays); btnAccessibilityService.setOnClickListener(v -> jumpToAccessSetting()); btnNotificationListener.setOnClickListener(v -> jumpToNotificationListenerSetting()); btnOverlays.setOnClickListener(v -> SettingsCompat.manageDrawOverlays(getActivity())); // 检查权限 CircularProgressButton btnCheckPermission = view.findViewById(R.id.btn_check_permission); btnCheckPermission.setOnClickListener(v -> { btnCheckPermission.performAccessibilityAction(AccessibilityEvent.TYPE_VIEW_CLICKED, null); btnCheckPermission.startAnimation(); ViewGroup llPermission = view.findViewById(R.id.ll_permission); llPermission.removeAllViews(); llPermission.addView((View) btnCheckPermission.getParent()); boolean accessibilityServiceSettingEnabled = isAccessibilityServiceSettingEnabled(); // handler.postDelayed(() -> addView(llPermission, "辅助功能权限授予", // accessibilityServiceSettingEnabled, // v1 -> jumpToAccessSetting()), 500); // boolean notificationListenerSettingEnabled = isNotificationListenerSettingEnabled(); // handler.postDelayed(() -> { // addView(llPermission, "通知监听服务开启", // notificationListenerSettingEnabled, // v1 -> jumpToNotificationListenerSetting()); // if (notificationListenerSettingEnabled) // sendNotification(); // }, 1000); handler.postDelayed(() -> { addView(llPermission, "辅助功能正常工作", accessibilityServiceSettingEnabled && !isAccessibilityServiceWork() ? " --请尝试重新打开开关" : null, isAccessibilityServiceWork(), v1 -> jumpToAccessSetting()); if (notificationListenerSettingEnabled) sendNotification(); }, 500); handler.postDelayed(() -> addView(llPermission, "通知监听服务正常工作", notificationListenerSettingEnabled && !isNotificationListenerWork() ? " --请尝试重新打开开关" : null, isNotificationListenerWork(), v1 -> jumpToNotificationListenerSetting()), 1000); handler.postDelayed(() -> addView(llPermission, "悬浮窗权限", null, checkFloatingPermission(), v1 -> SettingsCompat.manageDrawOverlays(getActivity())), 1500); handler.postDelayed(() -> addView(llPermission, "外部文件访问权限", null, checkWriteExternalStoragePermission(), v1 -> requestWriteExternalStorage()), 2000); handler.postDelayed(() -> { if (checkFloatingPermission() && checkWriteExternalStoragePermission() && accessibilityServiceSettingEnabled && isAccessibilityServiceWork() && notificationListenerSettingEnabled && isNotificationListenerWork()) btnCheckPermission.doneLoadingAnimation( getResources().getColor(R.color.colorCorrect), getBitmap(R.drawable.ic_accept)); else btnCheckPermission.doneLoadingAnimation( getResources().getColor(R.color.colorError), getBitmap(R.drawable.ic_cancel)); }, 2500); handler.postDelayed(btnCheckPermission::revertAnimation, 5000); }); }
Example 15
Source File: PhotoOverviewFragment.java From glimmr with Apache License 2.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mLayout = (ScrollView) inflater.inflate( R.layout.photo_overview_fragment, container, false); mTextViewISO = (TextView) mLayout.findViewById(R.id.textViewISO); mTextViewShutter = (TextView) mLayout.findViewById(R.id.textViewShutter); mTextViewAperture = (TextView) mLayout.findViewById(R.id.textViewAperture); mTextViewFocalLength = (TextView) mLayout.findViewById(R.id.textViewFocalLength); /* build the title textview */ TextView titleTextView = (TextView) mLayout.findViewById(R.id.textViewTitle); String title = mPhoto.getTitle(); if ("".equals(title)) { titleTextView.setText("‘" + getString(R.string.none) + "’"); } else { titleTextView.setText("‘" + title + "’"); } /* build the tags textview */ TextView mTextTags = (TextView) mLayout.findViewById(R.id.textViewTags); StringBuilder tags = new StringBuilder(); final Collection<Tag> allTags = mPhoto.getTags(); int count = 0; for (Tag t : allTags) { tags.append(t.getValue()); if (count < allTags.size()-1) { tags.append(" · "); } count++; } if ("".equals(tags.toString())) { mTextTags.setText("‘" + getString(R.string.none) + "’"); } else { mTextTags.setText(tags.toString()); mTextTags.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TagClickDialog d = new TagClickDialog(mActivity, PhotoOverviewFragment.this, allTags.toArray(new Tag[allTags.size()])); d.show(mActivity.getSupportFragmentManager(), "tags_click_dialog"); } }); } /* build the description textview */ TextView textviewDescription = (TextView) mLayout.findViewById(R.id.textViewDescription); String description = mPhoto.getDescription(); if ("".equals(description)) { textviewDescription.setText("‘" + getString(R.string.none) + "’"); } else { textviewDescription.setText(Html.fromHtml(description)); } setHasOptionsMenu(false); return mLayout; }
Example 16
Source File: LeftMenuFragment.java From iBeebo with GNU General Public License v3.0 | 3 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final ScrollView view = (ScrollView) inflater.inflate(R.layout.main_timeline_left_drawer_layout, container, false); mCoverBlureImage = ViewUtility.findViewById(view, R.id.coverBlureImage); displayCover(); layout = new LeftDrawerViewHolder(); layout.avatar = (ImageView) view.findViewById(R.id.avatar); layout.nickname = (TextView) view.findViewById(R.id.nickname); layout.home = (LinearLayout) view.findViewById(R.id.btn_home); // layot.location = (Button) view.findViewById(R.id.btn_location); layout.fav = (Button) view.findViewById(R.id.btn_favourite); layout.homeCount = (TextView) view.findViewById(R.id.tv_home_count); layout.leftDrawerSettingBtn = (Button) view.findViewById(R.id.leftDrawerSettingBtn); layout.homeButton = (Button) view.findViewById(R.id.homeButton); layout.mHotWeibo = ViewUtility.findViewById(view, R.id.btnHotWeibo); layout.mHotHuaTi = ViewUtility.findViewById(view, R.id.btnHotHuaTi); layout.mHotModel = ViewUtility.findViewById(view, R.id.btnHotModel); return view; }
Example 17
Source File: LeftMenuFragment.java From iBeebo with GNU General Public License v3.0 | 3 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final ScrollView view = (ScrollView) inflater.inflate(R.layout.main_timeline_left_drawer_layout, container, false); mCoverBlureImage = ViewUtility.findViewById(view, R.id.coverBlureImage); displayCover(); layout = new LeftDrawerViewHolder(); layout.avatar = (ImageView) view.findViewById(R.id.avatar); layout.nickname = (TextView) view.findViewById(R.id.nickname); layout.home = (LinearLayout) view.findViewById(R.id.btn_home); // layot.location = (Button) view.findViewById(R.id.btn_location); layout.fav = (Button) view.findViewById(R.id.btn_favourite); layout.homeCount = (TextView) view.findViewById(R.id.tv_home_count); layout.leftDrawerSettingBtn = (Button) view.findViewById(R.id.leftDrawerSettingBtn); layout.homeButton = (Button) view.findViewById(R.id.homeButton); layout.mHotWeibo = ViewUtility.findViewById(view, R.id.btnHotWeibo); layout.mHotHuaTi = ViewUtility.findViewById(view, R.id.btnHotHuaTi); layout.mHotModel = ViewUtility.findViewById(view, R.id.btnHotModel); return view; }