帧布局
来源:互联网 发布:hadoop wordcount源码 编辑:程序博客网 时间:2024/06/06 20:53
package com.example.myapplication;import android.graphics.Color;import android.os.Bundle;import android.support.v4.app.FragmentManager;import android.support.v4.app.FragmentTransaction;import android.support.v7.app.AppCompatActivity;import android.view.View;import android.widget.TextView;import fragments.Sy;import fragments.Wd;import fragments.Wtt;import fragments.Xg;public class MainActivity extends AppCompatActivity { private TextView shouye; private TextView xigua; private TextView wtt; private TextView wode; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);//查找控件 shouye = (TextView) findViewById(R.id.shouye); xigua = (TextView) findViewById(R.id.xigua); wtt = (TextView) findViewById(R.id.wtt); wode = (TextView) findViewById(R.id.wode);//展示第一个视图 FragmentManager manager=getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(R.id.fl,new Sy()); transaction.commit(); shouye.setTextColor(Color.RED); xigua.setTextColor(Color.GRAY); wtt.setTextColor(Color.GRAY); wode.setTextColor(Color.GRAY); //点击事件 shouye.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FragmentManager manager=getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(R.id.fl,new Sy()); transaction.commit(); shouye.setTextColor(Color.RED); xigua.setTextColor(Color.GRAY); wtt.setTextColor(Color.GRAY); wode.setTextColor(Color.GRAY); } }); xigua.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FragmentManager manager=getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(R.id.fl,new Xg()); transaction.commit(); shouye.setTextColor(Color.GRAY); xigua.setTextColor(Color.RED); wtt.setTextColor(Color.GRAY); wode.setTextColor(Color.GRAY); } }); wtt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FragmentManager manager=getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(R.id.fl,new Wtt()); transaction.commit(); shouye.setTextColor(Color.GRAY); xigua.setTextColor(Color.GRAY); wtt.setTextColor(Color.RED); wode.setTextColor(Color.GRAY); } }); wode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FragmentManager manager=getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(R.id.fl,new Wd()); transaction.commit(); shouye.setTextColor(Color.GRAY); xigua.setTextColor(Color.GRAY); wtt.setTextColor(Color.GRAY); wode.setTextColor(Color.RED); } }); }}
//布局<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/ll" android:id="@+id/fl"></FrameLayout>
阅读全文
0 0
- 帧布局
- 帧布局
- 帧布局
- 帧布局
- 帧布局
- 帧布局
- 帧布局
- 帧布局
- android的帧布局,绝对布局,相对布局,表格布局
- Android布局(线性布局 网格布局 帧布局)
- Android布局之帧布局
- FrameLayout布局(帧布局)
- Layout布局之帧布局
- Android -- UI布局管理,相对布局,线性布局,表格布局,绝对布局,帧布局
- Android 布局之线性布局、相对布局、表格布局、帧布局
- 二、Android的布局(相对布局和帧布局)
- Android中的界面布局之帧布局,相对布局
- android布局 FrameLayout (单帧布局)
- C++中const和C++的引用
- Codeforces Round #434
- 看完这个,css中position的绝对定位相对定位就懂了
- mysql批量插入:语法
- unity 头盔跟随一个物体移动(类似用HTC做过山车效果)
- 帧布局
- Spring定时之Quartz
- 自定义View系列教程01--常用工具介绍
- Kubernetes 针对资源紧缺处理方式的配置
- d-seperation 条件独立性
- 网络请求数据
- D
- 水平居中设置
- PostgreSQL 连接串URI配置(libpq兼容配置)