private boolean isFirstClick(){ SharedPreferences sp = getSharedPreferences(Constants.GET_EFAX_KEY, Context.MODE_PRIVATE); //在Constants类中设定一final value,存储,以便一次点击事件后不再显示 boolean firstclick = sp.getBoolean(Constants.GET_SHAREDPREF_EFAX_KEY, true); return firstclick; } private void setClickFalse(){ SharedPreferences sp = getSharedPreferences(Constants.GET_EFAX_KEY, Context.MODE_PRIVATE); Editor spEditor = sp.edit(); spEditor.putBoolean(Constants.GET_SHAREDPREF_EFAX_KEY, false); spEditor.commit(); }
1.在主layout创建一个layout来承载图片
<LinearLayout android:id="@+id/efax_guide" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/efax_guide" android:orientation="vertical" android:visibility="gone"> //不占空间不显示 </LinearLayout>
2.在oncreat里面调用该layout
mBtn_add_faxPDF = (RadioButton) findViewById(R.id.action_add_fax); //first time tips efaxGuide = (LinearLayout) findViewById(R.id.efax_guide); efaxGuide.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { efaxGuide.setVisibility(View.GONE); v.setVisibility(View.GONE); setClickFalse(); } }); if (isFirstClick()){ Locale locale = getResources().getConfiguration().locale; String language = locale.getLanguage(); if (language.endsWith("en")){ efaxGuide.setBackgroundDrawable(getResources().getDrawable(R.drawable.efax_guide)); } efaxGuide.setVisibility(View.VISIBLE); }
p.s:若first-time-tips不出现,怎可能是布局出现问题,注意不同的parent的覆盖问题
相关推荐
If you are a beginner, this list will be the first choice for you when you have a difficult time. Welcome Star and Fork, your support is my greatest affirmation. 学习 Android 至今,大大小小的坑没少踩...
The first edition of Mac Kung Fu was hugely successful, and this second edition has been thoroughly expanded and updated for OS X Mountain Lion. No other book has the same drive to help you boost ...
Based on the latest research in cognitive science and learning theory, Head First Agile uses a visually rich format to engage your mind, rather than a text-heavy approach that puts you to sleep....
First Edition LATEX is a beautiful programming language. One sometimes wants to write in an easy and quick way various documents, such as letters, papers, reports, theses, and so on. Here, “one” ...
Using rich controls such as pivots, panoramas, and controls in free toolkits, such as date/time pickers, toggle switches, charts, and graphs Building your own custom controls, including popular ones ...
Hundreds of thousands of... Offering hundreds of sample questions, critical time-saving tips plus games and activities available nowhere else, this book will help you pass the PMP exam on your first try.
Whether you’re upgrading to Office 2019 from a previous version or using it for the very first time, Office 2019 in easy steps will guide you through the key features so that you can be productive ...
Hundreds of thousands of... Offering hundreds of sample questions, critical time-saving tips plus games and activities available nowhere else, this book will help you pass the PMP exam on your FIRST try.
Hundreds of thousands of... Offering hundreds of sample questions, critical time-saving tips plus games and activities available nowhere else, this book will help you pass the PMP exam on your first try.
Windows 2000 Quick Fixes targets a selection of common problems, first- time tasks, and infrequently used features and provides quick and (usually) simple solutions to those issues. New users and ...
This book is a collection of recipes for the working Linux sysadmin–a set of stand-alone quick guides and tips that you can keep on your desk for easy reference. Hardcore in-depth manuals are great ...
Full Color INCLUDES COMPLETE CODE AND ASSETS FOR EACH APP IN THIS VOLUME!...Practical tips on a wide range of topics, even acquiring and creating sound effects, using custom fonts, and creating icons
Their ready-to-use ideas, tips, and solutions, will help save hours of programming time, prevent redundancy, and leave you with more time to add cutting-edge features to your own games. Covering all ...
When it's time for the final render, you will see how to setup Cycles in the best way. You will learn about a wide variety of materials, lighting, techniques, tips, and tricks to get the best out of ...
设计方向的最佳实践,内容有 1. Introduction 1-1 Preface 1-2 Recommended Pre-requisite and Reference Materials to Utilize with this...4-3 First accessing to a table with a large index may take long time
C Programming Professional Made Easy 2nd Edition Great new publication with first time ever released professional programming! Are you aware that C Programming is one of the most popular and most ...
Along the way, you’ll pick up lots of useful development tips. It contains: How to Create a Reddit Clone Using React and Firebase by Nirmalya Ghosh Build a CRUD App Using React, Redux and ...
Continuing in my pseudo-series of posts based on my ASP.NET MVC Ninjas on Fire Black Belt Tips Presentation at Mix (go watch it!), this post covers a demo I did not show because I ran out of time. It ...
Whether youare picking up Blend for the first time, or want to uncover all the newfeatures of Expression Blend 2, this series is just what you need toget you up and running fast. Highlights - ...