仿乐透购彩app(6)
来源:互联网 发布:数据分析ppt怎么做 编辑:程序博客网 时间:2024/04/28 19:20
仿乐透购彩app- - - 购彩界面
购彩布局界面如下
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <RelativeLayout android:layout_width="fill_parent" android:layout_height="40dip" android:layout_alignParentTop="true" android:background="#940400" android:orientation="horizontal" > <ImageView android:layout_width="40dip" android:layout_height="40dip" android:layout_alignParentLeft="true" android:src="@drawable/back" > </ImageView> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginLeft="40dip" android:orientation="horizontal" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="8" android:gravity="center" android:orientation="horizontal" > <TextView android:id="@+id/buylottery_title" android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="center" android:text="title" android:textColor="#ffffff" android:textSize="9pt" > </TextView> <TextView android:id="@+id/buylottery_title2" android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="center" android:text="title" android:textColor="#F7C36B" android:textSize="6pt" > </TextView> </LinearLayout> <ImageView android:layout_width="40dip" android:layout_height="40dip" android:layout_weight="2" android:gravity="right" android:src="@drawable/menu_down" > </ImageView> </LinearLayout> </RelativeLayout> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentBottom="true" android:layout_marginTop="40dip" android:background="#ffffff" > <!-- center --> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentTop="true" android:background="#ffffff" android:orientation="vertical" > <!-- top tool --> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <!-- 抽屉效果界面 --> <LinearLayout android:layout_width="fill_parent" android:layout_height="40dip" android:orientation="horizontal" > <LinearLayout android:id="@+id/buylottery_frame_item1" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="3.3" android:background="@drawable/tab1" > <TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:text="普通选号" android:textColor="#000000" android:textSize="6pt" /> </LinearLayout> <LinearLayout android:id="@+id/buylottery_frame_item2" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="3.3" android:background="@drawable/tab2" > <TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:text="胆拖选号" android:textColor="#000000" android:textSize="6pt" /> </LinearLayout> <LinearLayout android:id="@+id/buylottery_frame_item3" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="3.3" android:background="@drawable/tab2" > <TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:text="机选号码" android:textColor="#000000" android:textSize="6pt" /> </LinearLayout> </LinearLayout> </LinearLayout> <!-- change freame --> <LinearLayout android:orientation="vertical" android:id="@+id/buylottery_changeframe" android:layout_width="fill_parent" android:layout_height="wrap_content" > </LinearLayout> </LinearLayout> <!-- botton items --> <RelativeLayout android:layout_width="fill_parent" android:layout_height="90dip" android:layout_alignParentBottom="true" android:layout_marginTop="-90dip" android:background="#ffffff" > <LinearLayout android:layout_width="fill_parent" android:layout_height="40dip" android:layout_alignParentTop="true" android:background="#E7E3E7" android:orientation="horizontal" > <ImageView android:id="@+id/buylottery_add" android:layout_width="35dip" android:layout_height="35dip" android:layout_marginTop="2dip" android:src="@drawable/btnadd" > </ImageView> <EditText android:layout_width="80dip" android:layout_height="35dip" android:layout_marginTop="2dip" android:text="1" > </EditText> <ImageView android:id="@+id/buylottery_reduce" android:layout_width="35dip" android:layout_height="35dip" android:layout_marginTop="2dip" android:src="@drawable/btnreduce" > </ImageView> <TextView android:layout_width="wrap_content" android:layout_height="35dip" android:layout_marginTop="2dip" android:text="共0注" android:textColor="#000000" > </TextView> <TextView android:layout_width="wrap_content" android:layout_height="35dip" android:layout_marginTop="2dip" android:text="0" android:textColor="#950055" > </TextView> <TextView android:layout_width="wrap_content" android:layout_height="35dip" android:layout_marginTop="2dip" android:text="元" android:textColor="#000000" > </TextView> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="50dip" android:layout_alignParentBottom="true" android:background="#ffffff" android:orientation="horizontal" > <LinearLayout android:id="@+id/buylottery_bottom1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/buylttery_botton1_selector" android:orientation="vertical" > </LinearLayout> <LinearLayout android:id="@+id/buylottery_bottom2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/buylttery_botton2_selector" android:orientation="vertical" > </LinearLayout> <LinearLayout android:id="@+id/buylottery_bottom3" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/buylttery_botton3_selector" android:orientation="vertical" > </LinearLayout> <LinearLayout android:id="@+id/buylottery_bottom4" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/buylttery_botton4_selector" android:orientation="vertical" > </LinearLayout> </LinearLayout> </RelativeLayout> </RelativeLayout></RelativeLayout>
顶部的三个按钮控制着中间的LinearLayout的布局改变
/** *控制中间的布局显示内容 */ private void dobuylottery_frame_item(int layoutId) { buylottery_changeframe.removeAllViews(); View view = getLayoutInflater().inflate(layoutId, null); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); buylottery_changeframe.addView(view, params); }
逻辑代码
package com.chb.letou;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.view.Window;import android.widget.LinearLayout;import android.widget.TextView;import android.widget.LinearLayout.LayoutParams;/** * 购买彩票的界面 */public class BuyLotteryActivity extends Activity implements OnClickListener{ TextView buylottery_title ; //顶部三个选好按钮 LinearLayout buylottery_frame_item1; LinearLayout buylottery_frame_item2; LinearLayout buylottery_frame_item3; //底部四个按钮 private LinearLayout buylottery_bottom1; private LinearLayout buylottery_bottom2; private LinearLayout buylottery_bottom3; private LinearLayout buylottery_bottom4; private LinearLayout buylottery_changeframe; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_buylottery); initView(); Intent intent = getIntent(); String title = intent.getStringExtra("title"); buylottery_title.setText(title); dobuylottery_frame_item(R.layout.buylottery_shuangsheqiu_frame1); }; /** * 初始化view */ private void initView() { buylottery_title = (TextView) findViewById(R.id.buylottery_title); buylottery_frame_item1 = (LinearLayout) findViewById(R.id.buylottery_frame_item1); buylottery_frame_item2 = (LinearLayout) findViewById(R.id.buylottery_frame_item2); buylottery_frame_item3 = (LinearLayout) findViewById(R.id.buylottery_frame_item3); buylottery_frame_item1.setOnClickListener(this); buylottery_frame_item2.setOnClickListener(this); buylottery_frame_item3.setOnClickListener(this); //底部的四个按钮 buylottery_bottom1 = (LinearLayout) findViewById(R.id.buylottery_bottom1); buylottery_bottom2 = (LinearLayout) findViewById(R.id.buylottery_bottom2); buylottery_bottom3 = (LinearLayout) findViewById(R.id.buylottery_bottom3); buylottery_bottom4 = (LinearLayout) findViewById(R.id.buylottery_bottom4); buylottery_bottom1.setOnClickListener(this); buylottery_bottom2.setOnClickListener(this); buylottery_bottom3.setOnClickListener(this); buylottery_bottom4.setOnClickListener(this); buylottery_changeframe = (LinearLayout) findViewById(R.id.buylottery_changeframe); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.buylottery_frame_item1: resetTopButton(); buylottery_frame_item1.setBackgroundResource(R.drawable.tab1); dobuylottery_frame_item(R.layout.buylottery_shuangsheqiu_frame1); break; case R.id.buylottery_frame_item2: resetTopButton(); buylottery_frame_item2.setBackgroundResource(R.drawable.tab1); dobuylottery_frame_item(R.layout.buylottery_shuangsheqiu_frame2); break; case R.id.buylottery_frame_item3: buylottery_frame_item3.setBackgroundResource(R.drawable.tab1); dobuylottery_frame_item(R.layout.buylottery_shuangsheqiu_frame3); resetTopButton(); break; case R.id.buylottery_bottom4: break; case R.id.buylottery_bottom3: break; case R.id.buylottery_bottom2: break; case R.id.buylottery_bottom1: break; default: break; } } /** * 将购彩界面的顶部三个按钮设置为原始状态 */ private void resetTopButton(){ buylottery_frame_item3.setBackgroundResource(R.drawable.tab2); buylottery_frame_item2.setBackgroundResource(R.drawable.tab2); buylottery_frame_item1.setBackgroundResource(R.drawable.tab2); } /** *控制中间的布局显示内容 */ private void dobuylottery_frame_item(int layoutId) { buylottery_changeframe.removeAllViews(); View view = getLayoutInflater().inflate(layoutId, null); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); buylottery_changeframe.addView(view, params); }}
0 0
- 仿乐透购彩app(6)
- App图标(App Icons)
- IOS APP唤醒另一个APP(app之间互相通信)
- App Store统计工具(App Annie)
- 仿乐透购彩app(1)
- 仿乐透购彩app(2)
- 仿乐透购彩app(3)
- 仿乐透购彩app(4)
- 仿乐透购彩app(5)
- 仿乐透购彩app(7)
- xendesktop7.6发布app
- YourFavorite(Android App )
- android 系统分析(app)
- APP产品设计(一)
- APP逆向(上)
- APP逆向(中)
- 写app(转载)
- APP成本(1)
- 定义和声明以及extern、static关键字
- KMP
- 物体检测-CVPR16
- SpringMVC学习之路
- HDU 2298 Toxophily
- 仿乐透购彩app(6)
- 【知识积累】数据库访问方式
- CentOS6.5配置01 -- LAMP(appache,mysql,php)安装
- Leetcode-add-two-numbers
- CSS3基础
- Android中线程应用
- java 读写excel文件
- bzoj 3672 [Noi2014]购票 (线段树+凸壳)
- HDU2136 Largest prime factor