<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#fff"
>
<ImageView
android:src="@drawable/profile"
android:layout_marginTop="80dp"
android:layout_gravity="center"
android:layout_width="100dp"
android:layout_height="100dp" />
</LinearLayout>
package com.ikok.transitionandguidingpage;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
/**
* Created by Anonymous on 2016/3/25.
*/
public class TransitionActivity extends Activity {
boolean isFirstIn = false;
private Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.transition_view);
final SharedPreferences sharedPreferences = getSharedPreferences("is_first_in_data",MODE_PRIVATE);
isFirstIn = sharedPreferences.getBoolean("isFirstIn",true);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (isFirstIn) {
// Toast.makeText(TransitionActivity.this, "First log", Toast.LENGTH_SHORT).show();
intent = new Intent(TransitionActivity.this, GuideActivity.class);
TransitionActivity.this.startActivity(intent);
TransitionActivity.this.finish();
} else {
intent = new Intent(TransitionActivity.this, MainActivity.class);
TransitionActivity.this.startActivity(intent);
TransitionActivity.this.finish();
}
}
}, 2000);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v4.view.ViewPager>
</LinearLayout>
package com.ikok.transitionandguidingpage;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.Window;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Anonymous on 2016/3/26.
*/
public class GuideActivity extends FragmentActivity {
private ViewPager mViewPager;
private FragmentPagerAdapter mAdapter;
private List<Fragment> mFragment = new ArrayList<Fragment>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.guide_view);
mViewPager = (ViewPager) findViewById(R.id.viewpager);
Fragment guide1 = new Guide1();
Fragment guide2 = new Guide2();
Fragment guide3 = new Guide3();
mFragment.add(guide1);
mFragment.add(guide2);
mFragment.add(guide3);
mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return mFragment.get(position);
}
@Override
public int getCount() {
return mFragment.size();
}
};
// 为ViewPager添加动画效果,3.0以上可用
mViewPager.setPageTransformer(true,new DepthPageTransformer());
// mViewPager.setPageTransformer(true,new ZoomOutPageTransformer());
mViewPager.setAdapter(mAdapter);
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@drawable/guide3"
android:layout_height="match_parent">
<Button
android:id="@+id/into_app_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="进入App"
android:textColor="#fefefe"
android:background="@drawable/button_shape"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_marginBottom="50dp"
/>
</RelativeLayout>
package com.ikok.transitionandguidingpage;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
/**
* Created by Anonymous on 2016/3/27.
*/
public class Guide3 extends Fragment {
private Button mIntoAppBtn;
private View view;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.guide_view3,container,false);
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mIntoAppBtn = (Button) view.findViewById(R.id.into_app_btn);
mIntoAppBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), MainActivity.class);
startActivity(intent);
SharedPreferences sharedPreferences = getActivity().getSharedPreferences("is_first_in_data", 0x0000);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("isFirstIn", false);
editor.commit();
getActivity().finish();
}
});
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#00FFFFFF" />
<stroke android:color="#fefefe"
android:width="1dp"
/>
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="5dip" />
<!-- padding:Button里面的文字与Button边界的间隔 -->
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"
/>
</shape>
<pre name="code" class="html"><resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<!--空程序样式-->
<style name="EmptyTheme">
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ikok.transitionandguidingpage">
<application
android:allowBackup="true"
android:icon="@drawable/profile"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
</activity>
<!--应用空样式-->
<activity android:name=".TransitionActivity"
android:theme="@style/EmptyTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".GuideActivity">
</activity>
</application>
</manifest>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有