Adroid数据库的储存与访问(乐学成语)

来源:互联网 发布:对口型软件 编辑:程序博客网 时间:2024/04/27 16:02

乐学成语的设计结果

主要代码如下:

MainActivity.java

package com.bzu.happyidiom.controller;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.app.Activity;import android.app.TabActivity;import android.content.Intent;import android.view.Menu;import android.view.Window;import android.widget.TabHost;import android.widget.TextView;public class MainActivity extends TabActivity {TabHost mTabHost;private TextView tv_show;protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);getWindow().requestFeature(Window.FEATURE_CUSTOM_TITLE);setContentView(R.layout.actvity_main);Intent study_intent = new Intent();study_intent.setClass(MainActivity.this, StudyActivity.class);mTabHost = getTabHost();TabHost.TabSpec Tab1 = mTabHost.newTabSpec("tab1");Tab1.setIndicator("学习",getResources().getDrawable(R.drawable.study_study)).setContent(study_intent);mTabHost.addTab(Tab1);TabHost.TabSpec Tab2 = mTabHost.newTabSpec("tab2");Tab2.setIndicator("搜搜",getResources().getDrawable(R.drawable.study_search)).setContent(R.id.activity_search);mTabHost.addTab(Tab2);TabHost.TabSpec Tab3 = mTabHost.newTabSpec("tab3");Tab3.setIndicator("游戏",getResources().getDrawable(R.drawable.study_game)).setContent(R.id.activity_game);mTabHost.addTab(Tab3);TabHost.TabSpec Tab4 = mTabHost.newTabSpec("tab4");Tab4.setIndicator("收藏",getResources().getDrawable(R.drawable.study_save)).setContent(R.id.activity_save);mTabHost.addTab(Tab4);TabHost.TabSpec Tab5 = mTabHost.newTabSpec("tab5");Tab5.setIndicator("帮助",getResources().getDrawable(R.drawable.study_help)).setContent(R.id.activity_help);mTabHost.addTab(Tab5);getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_marquee);tv_show = (TextView) this.findViewById(R.id.tv_showSave);tv_show.append("一心一意" + " ");tv_show.append("三心二意" + " ");tv_show.append("有情有义" + " ");tv_show.append("一叶知秋" + " ");tv_show.append("风和日丽" + " ");tv_show.append("四平八稳" + " ");tv_show.append("一叶障目" + " ");}@Overridepublic boolean onCreateOptionsMenu(Menu menu) {// Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.main, menu);return true;}}


WelcomeActivity.java

package com.bzu.happyidiom.controller;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.view.Menu;import android.view.animation.AlphaAnimation;import android.view.animation.Animation;import android.view.animation.Animation.AnimationListener;import android.widget.ImageView;/** * 闪屏界面 */public class WelcomeActivity extends Activity {private ImageView welcomeImage;    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_welcome);        welcomeImage=(ImageView) this.findViewById(R.id.welcome);        //定义1个具有淡入效果的对象        AlphaAnimation alphaAnimation=new AlphaAnimation(0.1f,1.0f);        alphaAnimation.setDuration(3000);        welcomeImage.startAnimation(alphaAnimation);        alphaAnimation.setAnimationListener(new AnimationListener() {@Overridepublic void onAnimationStart(Animation animation) {}@Overridepublic void onAnimationRepeat(Animation animation) {}@Overridepublic void onAnimationEnd(Animation animation) {Intent intent=new Intent();intent.setClass(WelcomeActivity.this, MainActivity.class);startActivity(intent);finish();}});    }    @Override    public boolean onCreateOptionsMenu(Menu menu) {        getMenuInflater().inflate(R.menu.welcome, menu);        return true;    }    }


activitymain.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:paddingBottom="@dimen/activity_vertical_margin"    android:paddingLeft="@dimen/activity_horizontal_margin"    android:paddingRight="@dimen/activity_horizontal_margin"    android:paddingTop="@dimen/activity_vertical_margin"      tools:context=".MainActivity" >    <TabHost        android:id="@android:id/tabhost"        android:layout_width="fill_parent"        android:layout_height="fill_parent">        <LinearLayout       android:layout_width="match_parent"            android:layout_height="match_parent"            android:orientation="vertical" >            <TabWidget                android:id="@android:id/tabs"         android:layout_width="match_parent"                android:layout_height="wrap_content" >            </TabWidget>            <FrameLayout                android:id="@android:id/tabcontent"             android:layout_width="fill_parent"                android:layout_height="match_parent">                <include layout="@layout/activity_study"/>                <include layout="@layout/activity_search"/>                <include layout="@layout/activity_game"/>                <include layout="@layout/activity_save"/>                <include layout="@layout/activity_help"/>            </FrameLayout>        </LinearLayout>    </TabHost>    </RelativeLayout>

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 黑衣领衣服洗发黄怎么办 白毛衣用84变黄怎么办 白色貂毛衣变黄怎么办 蓝色T恤衣领汗積洗不掉怎么办 蓝色t恤衣领汗积洗不掉怎么办 羽绒服在衣柜里放黄了怎么办 白羽绒服放久了泛黄怎么办 白色t恤领子发黄怎么办 身体爱出油衣服领子总爱脏怎么办 白色衣服衣领净洗后变红怎么办 棒球服衣领洗变形怎么办 挂盐水手肿了怎么办 衣服买大了肩宽怎么办 买来的衣服肩宽怎么办 素描揉擦之后的黑点怎么办 扭脖子响了一下怎么办 画的眼线容易掉怎么办 做完眼线后眼睛肿了怎么办 洗眼线眼睛肿了怎么办 眼线留眼泪总是爱花妆怎么办 戴眼镜眼球外凸怎么办 修眉后的眉渣怎么办 内眼线容易晕妆怎么办 手抖不会画眼线怎么办 画眼线眼睛总眨怎么办 画眼线总是晕妆怎么办 眼线笔没用完干了怎么办 新的眼线笔干了怎么办 不涂口红没气色怎么办 眼线笔容易晕妆怎么办 眼线笔老是晕妆怎么办 眼线液老是晕妆怎么办 旋转眼线笔断了怎么办 眼睛去皮以后眉眼距窄怎么办 速写型总是画不准怎么办 速写人物不会打形怎么办 鼻头又圆又大怎么办 耳鸣嘴溃疡眼流泪上火怎么办 孩子看电视总挤眼睛怎么办 小孩老是咳嗽有痰怎么办 长时间看手机眼睛模糊怎么办