页面的建立(-)
来源:互联网 发布:php无限极分类简书 编辑:程序博客网 时间:2024/05/02 02:05
创建页面,原则经常改动的需要变换的可以单独写出来
如下子页面:
public class HomePager extends BasePager { public HomePager(Activity activity) { super(activity); } @Override public void initData() { tvTitle.setText("天下"); TextView textView = new TextView(mActivity); textView.setText("首页"); textView.setTextSize(25); textView.setTextColor(Color.RED); textView.setGravity(Gravity.CENTER); //向Framelayout动态加载布局 flContent.addView(textView); }}
basepager
/** * 主页面下的多个子页面的基类 * Created by admin on 2015/12/23. */public class BasePager { public Activity mActivity; public View mRootView; //布局对象 public TextView tvTitle; //标题对象 public FrameLayout flContent; //内容 public BasePager(Activity activity) { mActivity = activity; initViews(); } /** * 初始化布局 */ public void initViews() { mRootView = View.inflate(mActivity, R.layout.base_pager, null); tvTitle = (TextView) mRootView.findViewById(R.id.tv_title); flContent = (FrameLayout) mRootView.findViewById(R.id.fl_content); } /** * 初始化数据 */ public void initData() { }}
base_pager.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@mipmap/title_red_bg"> <ImageButton android:id="@+id/btn_menu" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/img_menu" android:layout_centerVertical="true" android:layout_marginLeft="5dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="xxxx" android:textSize="22sp" android:id="@+id/tv_title" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /> </RelativeLayout> <FrameLayout android:id="@+id/fl_content" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> </FrameLayout></LinearLayout>
传承者(Inheritors)欢迎各位纠正错误,评论,吐槽!!!
0 0
- 页面的建立(-)
- 页面的建立(二)
- jsp页面的建立
- 页面的建立
- 页面管理机制的初步建立
- hjr教程-JSP(一):一个jsp页面的建立
- 建立网站的自定义容错页面
- 建立复合页面的四种方法
- 建立discuz后台管理页面的模板
- asp.net页面生存周期之页面的建立
- 使用Flash的XMLSocket与Servlet建立长连接(7,测试的页面截图)
- 建立一个php页面,显示php的一些功能,并加以说明(php上传文件)
- 十六.增加一个项目协作留言板功能(二)----- 建立一个任务管理的列表页面
- 给你的WordPress站点建立个性化的友情链接页面
- 如何建立一个带登陆页面的Struts数据库应用程序
- 如何建立一个带登陆页面的Struts数据库应用程序
- 使用myeclipse与SQLyog怎么建立简单的登陆页面
- 使用Boostrap Modal建立loading页面的方法
- Android对Bitmap的内存优化方案总结
- [bzoj3163][HEOI2013]Eden的新背包问题
- 【Educational Codeforces Round 3 D】【二分答案 贪心排序】Gadgets for dollars and pounds m个物品n天价格买k个的最早天数
- javascript 表格增删改
- Oracle 行转列、列转行 的Sql语句总结
- 页面的建立(-)
- Python学习笔记----模块
- 超大规模系统架构设计的一般原则(最佳实践)
- The Earth Mover's Distance
- ubuntu14.04安装qq
- leetcode -- Distinct Subsequences -- DP重点
- HDU3065 病毒侵袭持续中(AC自动机或后缀数组)
- 关联规则-FP Tree
- 使用缓存Memcache存储更新微信access token