List of usage examples for android.widget ScrollView setOnTouchListener
public void setOnTouchListener(OnTouchListener l)
From source file:Main.java
public static void disableAutoScrollToBottom(ScrollView scrollView) { scrollView.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS); scrollView.setFocusable(true);/*from w ww. j a v a 2 s . c o m*/ scrollView.setFocusableInTouchMode(true); scrollView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { arg0.requestFocusFromTouch(); return false; } }); }
From source file:uk.co.tekkies.readings.fragment.PassageFragment.java
private void registerGestureDetector(View mainView) { scaleGestureDetector = new ScaleGestureDetector(getActivity(), new TextViewOnScaleGestureListener()); ScrollView rootView = (ScrollView) mainView.findViewById(R.id.scrollView1); rootView.setOnTouchListener(new OnTouchListener() { @Override//from w w w . jav a2s.c om public boolean onTouch(View v, MotionEvent event) { scaleGestureDetector.onTouchEvent(event); return scaleGestureDetector.isInProgress(); } }); }
From source file:com.nanostuffs.yurdriver.fragment.VehicalRegistration.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View view = inflater.inflate(R.layout.vehical_detail, container, false); carMake = (MyFontEdittextView) view.findViewById(R.id.carMake); carModel = (MyFontEdittextView) view.findViewById(R.id.carModel); LicenseNo = (MyFontEdittextView) view.findViewById(R.id.LicenceNo); ReistrationNo = (MyFontEdittextView) view.findViewById(R.id.RegistrationNo); PolicyNo = (MyFontEdittextView) view.findViewById(R.id.policyNo); clickSubmit = (MyFontTextView) view.findViewById(R.id.tvRegisterSubmit); typeCar = (Spinner) view.findViewById(R.id.cartype); clickSubmit.setOnClickListener(this); vehimg = (ImageView) view.findViewById(R.id.vehicalpic); licimg = (ImageView) view.findViewById(R.id.licensepic); numimg = (ImageView) view.findViewById(R.id.drRegistration); regimg = (ImageView) view.findViewById(R.id.insuranseCard); vehimg.setOnClickListener(this); licimg.setOnClickListener(this); numimg.setOnClickListener(this); regimg.setOnClickListener(this); Bundle bundle = getArguments();//from w w w . j a v a 2s .c o m loginType = bundle.getString("logInType"); socialId = bundle.getString("socialId"); fname = bundle.getString("fname"); lname = bundle.getString("lname"); email = bundle.getString("email"); pass = bundle.getString("pass"); proimg = bundle.getString("proimg"); mob = bundle.getString("mob"); gender = bundle.getString("gend"); address = bundle.getString("addr"); zip = bundle.getString("zip"); devtype = bundle.getString("devicetype"); token = bundle.getString("token"); logtype = bundle.getString("logintype"); if (RegisterFragment.vehicalImg != null) { File imgFileC = new File(RegisterFragment.vehicalImg); if (imgFileC.exists()) { Bitmap myBitmap = BitmapFactory.decodeFile(imgFileC.getAbsolutePath()); vehimg.setImageBitmap(myBitmap); } } if (RegisterFragment.licenseImg != null) { File imgFileL = new File(RegisterFragment.licenseImg); if (imgFileL.exists()) { Bitmap myBitmap = BitmapFactory.decodeFile(imgFileL.getAbsolutePath()); licimg.setImageBitmap(myBitmap); } } if (RegisterFragment.noPlateImg != null) { File imgFileI = new File(RegisterFragment.noPlateImg); if (imgFileI.exists()) { Bitmap myBitmap = BitmapFactory.decodeFile(imgFileI.getAbsolutePath()); numimg.setImageBitmap(myBitmap); } } if (RegisterFragment.regstrationImg != null) { File imgFileR = new File(RegisterFragment.regstrationImg); if (imgFileR.exists()) { Bitmap myBitmap = BitmapFactory.decodeFile(imgFileR.getAbsolutePath()); regimg.setImageBitmap(myBitmap); } } typeCar.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub carType = String.valueOf(position + 1); } @Override public void onNothingSelected(AdapterView<?> parent) { // TODO Auto-generated method stub } }); ScrollView v = (ScrollView) view.findViewById(R.id.scrollView1); v.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub HideSoftKeyBoard hid = new HideSoftKeyBoard(getActivity()); hid.hideKeyboard(getActivity()); return false; } }); return view; }
From source file:com.nanostuffs.yurdriver.fragment.RegisterFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View registerFragmentView = inflater.inflate(R.layout.fragment_register, container, false); ivProfile = (ImageView) registerFragmentView.findViewById(R.id.ivRegisterProfile); etRegisterAddress = (MyFontEdittextView) registerFragmentView.findViewById(R.id.etRegisterAddress); etDOB = (MyFontEdittextView) registerFragmentView.findViewById(R.id.dob); etCity = (MyFontEdittextView) registerFragmentView.findViewById(R.id.city); etState = (MyFontEdittextView) registerFragmentView.findViewById(R.id.state); etCountry = (MyFontEdittextView) registerFragmentView.findViewById(R.id.country); etRegisterBio = (Spinner) registerFragmentView.findViewById(R.id.etRegisterBio); etRegisterEmail = (MyFontEdittextView) registerFragmentView.findViewById(R.id.etRegisterEmail); etRegisterFname = (MyFontEdittextView) registerFragmentView.findViewById(R.id.etRegisterFName); etRegisterLName = (MyFontEdittextView) registerFragmentView.findViewById(R.id.etRegisterLName); etRegisterNumber = (MyFontEdittextView) registerFragmentView.findViewById(R.id.etRegisterNumber); etRegisterPassword = (MyFontEdittextView) registerFragmentView.findViewById(R.id.etRegisterPassword); etRegisterZipcode = (MyFontEdittextView) registerFragmentView.findViewById(R.id.etRegisterZipCode); tvCountryCode = (MyFontTextView) registerFragmentView.findViewById(R.id.tvRegisterCountryCode); btnFb = (MyFontButton) registerFragmentView.findViewById(R.id.btnRegisterFb); btnGplus = (MyFontButton) registerFragmentView.findViewById(R.id.btnRegisterGplus); /*lvTypes = (HorizontalListView) registerFragmentView .findViewById(R.id.lvTypes);*/ tvCountryCode.setOnClickListener(this); ivProfile.setOnClickListener(this); registerFragmentView.findViewById(R.id.btnRegisterFb).setOnClickListener(this); registerFragmentView.findViewById(R.id.btnRegisterGplus).setOnClickListener(this); registerFragmentView.findViewById(R.id.tvRegisterSubmit).setOnClickListener(this); ScrollView v = (ScrollView) registerFragmentView.findViewById(R.id.scrollView1); v.setOnTouchListener(new OnTouchListener() { @Override// w ww.j av a 2s . c o m public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub HideSoftKeyBoard hid = new HideSoftKeyBoard(getActivity()); hid.hideKeyboard(getActivity()); return false; } }); etDOB.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub datepicker(); } }); return registerFragmentView; }
From source file:com.eugene.fithealthmaingit.UI.NavFragments.FragmentJournalMainHome.java
/** * DragTopLayout displays the nutrition information * Attached to ScrollView//from w w w . j a v a 2 s .c om * When the scrollView y coordinates equal 0, the pull down is enabled */ private void InitializeDragTopLayout() { final DragTopLayout mDragLayout = (DragTopLayout) v.findViewById(R.id.drag_layout); mDragLayout.setOverDrag(false); mDragLayout.toggleTopView(); mDragLayout.listener(this); final ScrollView mScrollView = (ScrollView) v.findViewById(R.id.scrollView); mScrollView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { mDragLayout.setTouchMode(AttachUtil.isScrollViewAttach(mScrollView)); return false; } }); mCaloriePullDownView = (LinearLayout) v.findViewById(R.id.view4); Equations.dpToPx(getActivity(), 100); pullDownItems = (LinearLayout) v.findViewById(R.id.pullDownIems); mCalories = (TextView) v.findViewById(R.id.txtCalories); mCaloriesRemainder = (TextView) v.findViewById(R.id.txtRemainderCalories); mCalories.setTextSize(0); mCaloriesRemainder.setTextSize(0); View v1 = v.findViewById(R.id.view1); View v2 = v.findViewById(R.id.view2); View v3 = v.findViewById(R.id.view3); slide_down_padding = Math.round(Equations.dpToPx(getActivity(), 90)); v1.setPadding(slide_down_padding, 0, slide_down_padding, 0); v2.setPadding(slide_down_padding, 0, slide_down_padding, 0); v3.setPadding(slide_down_padding, 0, slide_down_padding, 0); }
From source file:com.nikolak.weatherapp.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container); //swipeLayout.setOnRefreshListener(this); settings = this.getSharedPreferences(PREFS_NAME, 0); buildGoogleApiClient();//from w w w . jav a 2 s . c om ScrollView mainScroll = (ScrollView) findViewById(R.id.mainScrollView); hourLIst = (ListView) findViewById(R.id.twoDayList); hourLIst.setAdapter(new HourListAdapter(this, forecast.hourly.getHourData())); weekList = (ListView) findViewById(R.id.weekList); weekList.setAdapter(new WeekListAdapter(this, forecast.daily.getDayData())); // Assign current weather card elements to variables currentIcon = (ImageView) findViewById(R.id.currentIcon); currentDescription = (TextView) findViewById(R.id.currentDescription); currentFeelsLike = (TextView) findViewById(R.id.currentFeelsLike); currentWind = (TextView) findViewById(R.id.currentWind); currentHumidity = (TextView) findViewById(R.id.currentHumidity); currentTemperature = (TextView) findViewById(R.id.currentTemperature); currentLow = (TextView) findViewById(R.id.currentLow); currentHigh = (TextView) findViewById(R.id.currentHigh); // Assign next hour/day card elements to variables nextHourDesc = (TextView) findViewById(R.id.nextHourDesc); nextDayDesc = (TextView) findViewById(R.id.nextDayDesc); // Add on touch listeners to allow scrolling of the lists inside scrollview mainScroll.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { findViewById(R.id.twoDayList).getParent().requestDisallowInterceptTouchEvent(false); return false; } }); hourLIst.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { v.getParent().requestDisallowInterceptTouchEvent(true); return false; } }); weekList.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { v.getParent().requestDisallowInterceptTouchEvent(true); return false; } }); }
From source file:com.df.dfcarchecker.CarCheck.CarCheckBasicInfoFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Random r=new Random(); // int uniqueNumber =(r.nextInt(999) + 100); // uniqueId = Integer.toString(uniqueNumber); // ?uniqueId//www . j a va2 s . co m UUID uuid = UUID.randomUUID(); uniqueId = uuid.toString(); this.inflater = inflater; rootView = inflater.inflate(R.layout.fragment_car_check_basic_info, container, false); // <editor-fold defaultstate="collapsed" desc="??View?"> tableLayout = (TableLayout) rootView.findViewById(R.id.bi_content_table); contentLayout = (LinearLayout) rootView.findViewById(R.id.brand_input); Button vinButton = (Button) rootView.findViewById(R.id.bi_vin_button); vinButton.setOnClickListener(this); brandOkButton = (Button) rootView.findViewById(R.id.bi_brand_ok_button); brandOkButton.setEnabled(false); brandOkButton.setOnClickListener(this); brandSelectButton = (Button) rootView.findViewById(R.id.bi_brand_select_button); brandSelectButton.setEnabled(false); brandSelectButton.setOnClickListener(this); // ?? sketchPhotoEntities = new ArrayList<PhotoEntity>(); // Button matchButton = (Button) rootView.findViewById(R.id.ct_licencePhotoMatch_button); matchButton.setOnClickListener(this); // vin??? InputFilter alphaNumericFilter = new InputFilter() { @Override public CharSequence filter(CharSequence arg0, int arg1, int arg2, Spanned arg3, int arg4, int arg5) { for (int k = arg1; k < arg2; k++) { if (!Character.isLetterOrDigit(arg0.charAt(k))) { return ""; } } return null; } }; vin_edit = (EditText) rootView.findViewById(R.id.bi_vin_edit); vin_edit.setFilters(new InputFilter[] { alphaNumericFilter, new InputFilter.AllCaps() }); brandEdit = (EditText) rootView.findViewById(R.id.bi_brand_edit); displacementEdit = (EditText) rootView.findViewById(R.id.csi_displacement_edit); transmissionEdit = (EditText) rootView.findViewById(R.id.csi_transmission_edit); runEdit = (EditText) rootView.findViewById(R.id.bi_mileage_edit); // // transmissionSpinner = (Spinner)rootView.findViewById(R.id.csi_transmission_spinner); // transmissionSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { // @Override // public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { // transmissionEdit.setText(adapterView.getSelectedItem().toString()); // } // // @Override // public void onNothingSelected(AdapterView<?> adapterView) { // // } // }); // ?????? ScrollView view = (ScrollView) rootView.findViewById(R.id.root); view.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS); view.setFocusable(true); view.setFocusableInTouchMode(true); view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { v.requestFocusFromTouch(); return false; } }); // ????????2? runEdit.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable edt) { String temp = edt.toString(); if (temp.contains(".")) { int posDot = temp.indexOf("."); if (posDot <= 0) return; if (temp.length() - posDot - 1 > 2) { edt.delete(posDot + 3, posDot + 4); } } else { if (temp.length() > 2) { edt.clear(); edt.append(temp.substring(0, 2)); } } } public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } }); licencePhotoMatchEdit = (EditText) rootView.findViewById(R.id.ct_licencePhotoMatch_edit); licencePhotoMatchEdit.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { licencePhotoMatchEdit.setError(null); } @Override public void afterTextChanged(Editable editable) { licencePhotoMatchEdit.setError(null); } }); // ?? carNumberEdit = (EditText) rootView.findViewById(R.id.ci_plateNumber_edit); carNumberEdit.setFilters(new InputFilter[] { new InputFilter.AllCaps(), new InputFilter.LengthFilter(10) }); // ? portedProcedureRow = (TableRow) rootView.findViewById(R.id.ct_ported_procedure); // ?Spinner setRegLocationSpinner(); setCarColorSpinner(); setFirstLogTimeSpinner(); setManufactureTimeSpinner(); setTransferCountSpinner(); setLastTransferTimeSpinner(); setYearlyCheckAvailableDateSpinner(); setAvailableDateYearSpinner(); setBusinessInsuranceAvailableDateYearSpinner(); setOtherSpinners(); // </editor-fold> mCarSettings = new CarSettings(); // ??xml if (vehicleModel == null) { mProgressDialog = ProgressDialog.show(rootView.getContext(), null, "?..", false, false); Thread thread = new Thread(new Runnable() { @Override public void run() { try { ParseXml(); // jsonData?? if (!jsonData.equals("")) { modifyMode = true; letsEnterModifyMode(); } } catch (Exception e) { e.printStackTrace(); } } }); thread.start(); } return rootView; }
From source file:es.ugr.swad.swadroid.modules.tests.TestsMake.java
/** * Shows a test question on screen/*from w w w . j a v a2 s .co m*/ * * @param pos Question's position in questions's list of the test */ private void showQuestion(int pos) { TestQuestion question = test.getQuestions().get(pos); List<TestAnswer> answers = question.getAnswers(); TestAnswer a; ScrollView scrollContent = (ScrollView) findViewById(R.id.testMakeScroll); LinearLayout testMakeList = (LinearLayout) findViewById(R.id.testMakeList); TextView stem = (TextView) findViewById(R.id.testMakeQuestionStem); TextView questionFeedback = (TextView) findViewById(R.id.testMakeQuestionFeedback); TextView answerFeedback = (TextView) findViewById(R.id.testMakeAnswerFeedback); TextView score = (TextView) findViewById(R.id.testMakeQuestionScore); TextView textCorrectAnswer = (TextView) findViewById(R.id.testMakeCorrectAnswer); EditText textAnswer = (EditText) findViewById(R.id.testMakeEditText); ImageView img = (ImageView) findViewById(R.id.testMakeCorrectAnswerImage); MenuItem actionScoreItem = menu.findItem(R.id.action_score); CheckedAnswersArrayAdapter checkedAnswersAdapter; String answerType = question.getAnswerType(); String feedback = test.getFeedback(); String questionFeedbackText = question.getFeedback(); String correctAnswer = ""; int numAnswers = answers.size(); Float questionScore; DecimalFormat df = new DecimalFormat("0.00"); int feedbackLevel; int mediumFeedbackLevel = Test.FEEDBACK_VALUES.indexOf(Test.FEEDBACK_MEDIUM); int maxFeedbackLevel = Test.FEEDBACK_VALUES.indexOf(Test.FEEDBACK_MAX); scrollContent.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { findViewById(R.id.testMakeList).getParent().requestDisallowInterceptTouchEvent(false); return false; } }); testMakeList.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { // Disallow the touch request for parent scroll on touch of child view v.getParent().requestDisallowInterceptTouchEvent(true); return false; } }); questionFeedback.setVisibility(View.GONE); answerFeedback.setVisibility(View.GONE); textAnswer.setVisibility(View.GONE); textCorrectAnswer.setVisibility(View.GONE); testMakeList.setVisibility(View.GONE); img.setVisibility(View.GONE); testMakeList.removeAllViews(); stem.setText(Html.fromHtml(question.getStem())); if ((questionFeedbackText != null) && (!questionFeedbackText.equals(Constants.NULL_VALUE))) { questionFeedback.setText(Html.fromHtml(questionFeedbackText)); } feedbackLevel = Test.FEEDBACK_VALUES.indexOf(feedback); if (test.isEvaluated() && (feedbackLevel == maxFeedbackLevel) && !question.getFeedback().equals(Constants.NULL_VALUE)) { questionFeedback.setVisibility(View.VISIBLE); } else { questionFeedback.setVisibility(View.GONE); } if (answerType.equals(TestAnswer.TYPE_TEXT) || answerType.equals(TestAnswer.TYPE_INT) || answerType.equals(TestAnswer.TYPE_FLOAT)) { if (answerType.equals(TestAnswer.TYPE_INT)) { textAnswer.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED); } else if (answerType.equals(TestAnswer.TYPE_FLOAT)) { textAnswer.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED); } else { textAnswer.setInputType(InputType.TYPE_CLASS_TEXT); } a = answers.get(0); textAnswer.setText(a.getUserAnswer()); textAnswer.setVisibility(View.VISIBLE); answerFeedback.setText(Html.fromHtml(a.getFeedback())); if (test.isEvaluated() && (feedbackLevel > mediumFeedbackLevel)) { if (answerType.equals(TestAnswer.TYPE_FLOAT)) { correctAnswer = "[" + a.getAnswer() + ";" + answers.get(1).getAnswer() + "]"; if ((feedbackLevel == maxFeedbackLevel) && !a.getFeedback().equals(Constants.NULL_VALUE)) { answerFeedback.setVisibility(View.VISIBLE); } else { answerFeedback.setVisibility(View.GONE); } } else { for (int i = 0; i < numAnswers; i++) { a = answers.get(i); if ((feedbackLevel == maxFeedbackLevel) && !a.getFeedback().equals(Constants.NULL_VALUE)) { correctAnswer += "<strong>" + a.getAnswer() + "</strong><br/>"; correctAnswer += "<i>" + a.getFeedback() + "</i><br/><br/>"; } else { correctAnswer += a.getAnswer() + "<br/>"; } } } textCorrectAnswer.setText(Html.fromHtml(correctAnswer)); textCorrectAnswer.setVisibility(View.VISIBLE); } } else if (answerType.equals(TestAnswer.TYPE_MULTIPLE_CHOICE)) { checkedAnswersAdapter = new CheckedAnswersArrayAdapter(this, R.layout.list_item_multiple_choice, answers, test.isEvaluated(), test.getFeedback(), answerType); for (int i = 0; i < numAnswers; i++) { a = answers.get(i); CheckableLinearLayout item = (CheckableLinearLayout) checkedAnswersAdapter.getView(i, null, null); item.setChecked(Utils.parseStringBool(a.getUserAnswer())); testMakeList.addView(item); } testMakeList.setVisibility(View.VISIBLE); } else { if (answerType.equals(TestAnswer.TYPE_TRUE_FALSE) && (numAnswers < 2)) { if (answers.get(0).getAnswer().equals(TestAnswer.VALUE_TRUE)) { answers.add(1, new TestAnswer(0, 1, 0, false, TestAnswer.VALUE_FALSE, answers.get(0).getFeedback())); } else { answers.add(0, new TestAnswer(0, 0, 0, false, TestAnswer.VALUE_TRUE, answers.get(0).getFeedback())); } numAnswers = 2; } checkedAnswersAdapter = new CheckedAnswersArrayAdapter(this, R.layout.list_item_single_choice, answers, test.isEvaluated(), test.getFeedback(), answerType); for (int i = 0; i < numAnswers; i++) { a = answers.get(i); CheckableLinearLayout item = (CheckableLinearLayout) checkedAnswersAdapter.getView(i, null, null); item.setChecked(a.getAnswer().equals(answers.get(0).getUserAnswer())); testMakeList.addView(item); } testMakeList.setVisibility(View.VISIBLE); } if (test.isEvaluated() && (feedbackLevel > mediumFeedbackLevel)) { textAnswer.setEnabled(false); textAnswer.setOnClickListener(null); if (feedback.equals(Test.FEEDBACK_HIGH)) { img.setImageResource(R.drawable.btn_check_buttonless_on); if (!answerType.equals(TestAnswer.TYPE_TRUE_FALSE) && !answerType.equals(TestAnswer.TYPE_MULTIPLE_CHOICE) && !answerType.equals(TestAnswer.TYPE_UNIQUE_CHOICE)) { if (!answers.get(0).isCorrectAnswered()) { img.setImageResource(android.R.drawable.ic_delete); } img.setVisibility(View.VISIBLE); } } questionScore = test.getQuestionScore(pos); if (questionScore > 0) { score.setTextColor(getResources().getColor(R.color.green)); } else if (questionScore < 0) { score.setTextColor(getResources().getColor(R.color.red)); } else { score.setTextColor(Color.BLACK); } score.setText(df.format(questionScore)); MenuItemCompat.setActionView(actionScoreItem, score); actionScoreItem.setVisible(true); } }