`

first time tips

阅读更多
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的覆盖问题

分享到:
评论

相关推荐

    Android代码-Android-Tips

    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 至今,大大小小的坑没少踩...

    Mac Kung Fu Over 400 Tips Tricks Hints and Hacks for Apple OS X 2nd Edition

    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 ...

    Head First Agile [True PDF]

    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....

    A-Practical-Guide-to-LATEX-Tips.pdf

    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” ...

    PMP Exam Prep, 6th Edition

    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.

    PMP Exam Prep - Sixth Edition

    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.

    PMP Exam prep, Sixth Edition

    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.

    Game Programming Gems 3

    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 ...

    Blender Cycles Lighting and Rendering Cookbook.pdf

    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 ...

    DB2pureScale_Practical_Design_Guide_2016-Feb-5.pptx

    设计方向的最佳实践,内容有 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.1508818665.epub

    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 ...

    《5 Practical React Projects》2017 英文原版 Kindle - mobi格式

    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 ...

    JQueryGridDemo

    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 ...

    Expression.Blend.2.基本教程 示例代码

    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 - ...

    Java SE 8 Programmer I Study Guide: Exam 1Z0-808

    The release of Java 8 brought the language's biggest changes to date, and for the first time, candidates are required to learn functional programming to pass the exam. This study guide has you ...

    DTrace Dynamic Tracing In Oracle Solaris, Mac OS X & FreeBSD PDF

    Now, for the first time, there's a comprehensive, authoritative guide to making the most of DTrace in any supported UNIX environment--from Oracle Solaris to OpenSolaris, Mac OS X, and FreeBSD. ...

    High-Performance.iOS.Apps.149191100X

    Now that more people spend more time interacting with mobile apps than with their desktop counterparts, you need to think about your iOS app’s performance the moment you write your first line of code...

    Drupal 8 Module Development 2nd Edition

    In his spare time, he runs webomelette, a Drupal website where he writes technical articles, tips, and techniques related to Drupal development. Table of Contents Developing for Drupal 8 Creating ...

Global site tag (gtag.js) - Google Analytics