新浪微博项目04_主UI

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

UI流程功能描述:呈现用户微博的首页信息,显示所有关注用户的最新微博,是各种操作的中心窗口。点击刷新获取最新数据点击更多内容获取下一页左上角图标出现发表微博窗口右上角为刷新窗口按钮按下Menu出现内容跳转流程:可以跳转到各个子功能窗口,用户按下返回键弹出对话框提示用户是否退出。Res/layout/maintab.xml?xmlversion=1.0encoding=UTF-8?TabHostandroid:id=@android:id/tabhostandroid:layout_width=fill_parentandroid:layout_height=fill_parentxmlns:android=:orientation=verticalandroid:layout_width=fill_parentandroid:layout_height=fill_parentFrameLayoutandroid:id=@android:id/tabcontentandroid:layout_width=fill_parentandroid:layout_height=0.0dipandroid:layout_weight=1.0/TabWidgetandroid:id=@android:id/tabsandroid:visibility=goneandroid:layout_width=fill_parentandroid:layout_height=wrap_contentandroid:layout_weight=0.0/RadioGroupandroid:gravity=center_verticalandroid:layout_gravity=bottomandroid:orientation=horizontalandroid:id=@id/main_radioandroid:background=@drawable/maintab_toolbar_bgandroid:layout_width=fill_parentandroid:layout_height=wrap_contentRadioButtonandroid:id=@+id/radio_button0android:tag=radio_button0android:layout_marginTop=2.0dipandroid:text=@string/main_homeandroid:drawableTop=@drawable/icon_1_nstyle=@style/main_tab_bottom/RadioButtonandroid:id=@+id/radio_button1android:tag=radio_button1android:layout_marginTop=2.0dipandroid:text=@string/main_newsandroid:drawableTop=@drawable/icon_2_nstyle=@style/main_tab_bottom/RadioButtonandroid:id=@+id/radio_button2android:tag=radio_button2android:layout_marginTop=2.0dipandroid:text=@string/main_my_infoandroid:drawableTop=@drawable/icon_3_nstyle=@style/main_tab_bottom/RadioButtonandroid:id=@+id/radio_button3android:tag=radio_button3android:layout_marginTop=2.0dipandroid:text=@string/menu_searchandroid:drawableTop=@drawable/icon_4_nstyle=@style/main_tab_bottom/RadioButtonandroid:id=@+id/radio_button4android:tag=radio_button4android:layout_marginTop=2.0dipandroid:text=@string/moreandroid:drawableTop=@drawable/icon_5_nstyle=@style/main_tab_bottom//RadioGroup/LinearLayout/TabHost编码添加页框内容•mHost=this.getTabHost();•mHost.addTab(mHost.newTabSpec(TAB_HOME).setIndicator(TAB_HOME)•.setContent(newIntent(MainActivity.this,HomeActivity.class)));•mHost.addTab(mHost.newTabSpec(TAB_MES).setIndicator(TAB_MES)•.setContent(newIntent(MainActivity.this,MsgActivity.class)));•mHost.addTab(mHost.newTabSpec(TAB_CONTACT).setIndicator(TAB_CONTACT)•.setContent(newIntent(MainActivity.this,MyContactActivity.class)));•mHost.addTab(mHost.newTabSpec(TAB_SEARCH).setIndicator(TAB_SEARCH)•.setContent(newIntent(MainActivity.this,SearchActivity.class)));•mHost.addTab(mHost.newTabSpec(TAB_MORE).setIndicator(TAB_MORE)•.setContent(newIntent(MainActivity.this,MoreActivity.class)));•mHost.addTab(mHost.newTabSpec(TAB_MAINAT).setIndicator(TAB_MAINAT)•.setContent(newIntent(MainActivity.this,MyContactAtActivity.class)));•mHost.addTab(mHost.newTabSpec(TAB_MESSAGE).setIndicator(TAB_MESSAGE)•.setContent(newIntent(MainActivity.this,MyContactMessageActivity.class)));使用Radio实现Tab效果•//信息标题获取•msg_title=findViewById(R.id.msg_title);•main_at=(Button)msg_title.findViewById(R.id.bt_group_left);•main_comment=(Button)msg_title.findViewById(R.id.bt_group_middle);•main_message=(Button)msg_title.findViewById(R.id.bt_group_right);•main_at.setTag(MAIN_AT);•main_comment.setTag(MAIN_COMMENT);•main_message.setTag(MAIN_MESSAGE);•main_at.setOnClickListener(this);•main_comment.setOnClickListener(this);•main_message.setOnClickListener(this);RadioGroup事件侦听改变Tab•radioderGroup=(RadioGroup)findViewById(R.id.main_radio);•radioderGroup.setOnCheckedChangeListener(this);•home=(RadioButton)findViewById(R.id.radio_button0);•home.setId(HOME);•mes=(RadioButton)findViewById(R.id.radio_button1);•mes.setId(MES);•my_contact=(RadioButton)findViewById(R.id.radio_button2);•my_contact.setId(MY_CONTACT);•search=(RadioButton)findViewById(R.id.radio_button3);•search.setId(SEARCH);•more=(RadioButton)findViewById(R.id.radio_button4);•more.setId(MORE);•//各Radio的事件•publicvoidonCheckedChanged(RadioGroupgroup,intcheckedId){•msg_title.setVisibility(View.GONE);//把显示个人信息的TITLE隐藏•switch(checkedId){•caseHOME:•mHost.setCurrentTabByTag(TAB_HOME);•break;•。。。。。。。。..;•}•}•title_new_normal.pngtitle_new_selected.pngtitle_reload_selected.pngtitle_reload_normal.pngDrawable/titlenew.xml?xmlversion=1.0encoding=UTF-8?selectorxmlns:android=:state_focused=trueandroid:drawable=@drawable/title_new_selected/itemandroid:state_selected=trueandroid:drawable=@drawable/title_new_selected/itemandroid:state_pressed=trueandroid:drawable=@drawable/title_new_selected/itemandroid:drawable=@drawable/title_new_normal//selectorbtnew.setBackgroundResource(R.drawable.title_button_newbolg);btrefresh.setBackgroundResource(R.drawable.title_button_refresh);ToptwoButton顶部处理图片资源:Menu图片资源officialweibo.pngmenu_exit.pngcomment.pngaboutweibo.pngswitchuser.pngsetting.png35X35Menu的实现Menu的实现home和info•publicbooleanonCreateOptionsMenu(Menumenu){•//TODOAuto-generatedmethodstub•menu.add(1,1,1,).setIcon(R.dra

1 / 41
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功