<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.yuekaomoni_99.MainActivity"> <RadioGroup
android:layout_width="match_parent"
android:background="#f00"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:id="@+id/rg">
<RadioButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/rb_index"
android:checked="true"
android:layout_weight="1"
android:text="首页" android:button="@null"
android:gravity="center"/> <!--文字颜色的改变 1.res新建一个color文件夹 2.color文件夹内 新建selector,<item android:color="" 3.radiobutton的属性 android:textColor=@color/....>-->
<RadioButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/rb_mind"
android:layout_weight="1"
android:gravity="center"
android:text="想法" android:button="@null"/> </RadioGroup> <FrameLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fcontent"
></FrameLayout> </RelativeLayout> ------------------------------------------------------------------------------------------------------------
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.view.View;
import android.widget.FrameLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup; public class MainActivity extends AppCompatActivity { private FrameLayout fcontent;
private RadioButton rb_index;
private RadioButton rb_main; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fcontent = findViewById(R.id.fcontent);
RadioGroup radioGroup=findViewById(R.id.rg);
rb_index = findViewById(R.id.rb_index);
rb_main = findViewById(R.id.rb_mind);
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
switch (i){
case R.id.rb_index:
getSupportFragmentManager().beginTransaction().replace(R.id.fcontent,new Fragment_01()).commit();
break;
case R.id.rb_mind:
getSupportFragmentManager().beginTransaction().replace(R.id.fcontent,new MindFragment()).commit();
break;
}
}
}); //设置初始fragment页面
getSupportFragmentManager().beginTransaction().
replace(R.id.fcontent,new Fragment_01()).commit(); }}

frag的更多相关文章

  1. frag General URL components

    HTTP: The Definitive Guide 2.2.7 Fragments Some resource types, such as HTML, can be divided further ...

  2. Frag(匹配跟踪)

    ‘碎片’(Frag)跟踪是目标跟踪里的一种通过‘部分‘匹配识别的方法,其目标模板是通过图像多个碎片和块来描述.块是任意的,不基于目标模型的(与传统的基于’部分‘的方法不一样,比如人体的四肢与躯干的跟踪 ...

  3. Unity3d 镜面反射 vertex and frag Shader源代码

    Unity3d 镜面反射 网上能找到的基本上是固定管道或表面渲染的shader. 特此翻译为顶点.片段渲染的Shader, 本源代码仅仅涉及shader与cs部分. Editor部分使用NGUI绘制的 ...

  4. Unity3d 镜面折射 vertex and frag Shader源代码

    Unity3d 镜面折射  网上能找到的基本上是固定管道或表面渲染的shader. 特此翻译为顶点.片段渲染的Shader, 本源代码仅仅涉及shader与cs部分, 请自行下载NGUI  unity ...

  5. Error loading XML document: dwz.frag.xml 处理方式

    问题:直接用IE打开index.html弹出一个对话框:Error loading XML document: dwz.frag.xml 方案一(已经验证): 转自:http://blog.csdn. ...

  6. Grow heap (frag case) to 6.437MB for 1114126-byte allocation

    本篇文章是对Grow heap (frag case) 堆内存过大的问题进行了详细的分析介绍,需要的朋友参考下 对于Android开发者来说虽然使用了可以自动管理内存的Java语言,但是对于内存管理不 ...

  7. Vertex&Frag

    一.Vertex&Frag 包含Vertex&Fragment 的Shader叫做顶点&像素着色器,在Vertex的功能函数中,我们侧重于几何计算,如纹理坐标,顶点坐标等:在F ...

  8. CSharpGL(33)使用uniform块来优化对uniform变量的读写

    CSharpGL(33)使用uniform块来优化对uniform变量的读写 +BIT祝威+悄悄在此留下版了个权的信息说: Uniform块 如果shader程序变得比较复杂,那么其中用到的unifo ...

  9. 原生JS实现-星级评分系统

    今天我又写了个很酷的实例:星级评分系统(可自定义星星个数.显示信息) sufuStar.star();使用默认值5个星星,默认信息 var msg = [........]; sufuStar.sta ...

随机推荐

  1. windows端运行.sh脚本

    在复现lightheadrcnn时,碰到这么一句    bash make.sh 下载cygwin安装 在cygwin安装过程中,在选择安装包的时候找到Devel 再在Devel里面找到make,勾选 ...

  2. leetcode python 037 求解数独

    import numpy as npimport syssys.setrecursionlimit(1000) #例如这里设置为一百万 def get1(n):    if n<3:       ...

  3. MySql主从搭建详细步骤

    环境: linux64位,一台机器两个实例,主库3306端口,从库3307端口 步骤: 一.下载安装 先下载安装mysql,这里使用了5.7.21版本,具体过程不做详细说明,可自行查资料如何下载 二. ...

  4. day13笔记

    1:StringBuffer(掌握) (1)用字符串做拼接,比较耗时并且也耗内存,而这种拼接操作又是比较常见的,为了解决这个问题,Java就提供了 一个字符串缓冲区类.StringBuffer供我们使 ...

  5. SQL-56 获取所有员工的emp_no、部门编号dept_no以及对应的bonus类型btype和recevied,没有分配具体的员工不显示

    获取所有员工的emp_no.部门编号dept_no以及对应的bonus类型btype和recevied,没有分配具体的员工不显示CREATE TABLE `dept_emp` ( `emp_no` i ...

  6. servlet异步处理机制

    Servlet 3.0 之前,一个普通 Servlet 的主要工作流程大致如下:首先,Servlet 接收到请求之后,可能需要对请求携带的数据进行一些预处理:接着,调用业务接口的某些方法,以完成业务处 ...

  7. callback理解

    ex:       var fn1 = function(callback){             //do something             callback && c ...

  8. ionic3 对android包进行签名

    在已经生成签名文件的前提下 对android包进行签名 如果还未生成签名文件 请参考链接 https://jingyan.baidu.com/article/642c9d34eaeeda644a46f ...

  9. 修改VScode行号区的背景颜色

    vs code是相当不错的一个编辑器,现阶段我用来编写nim程序. vs code非常丧心病狂一点就是行号区和编辑区的背景颜色都是一样, 这样会导致要看行首有没有对齐会非常吃力.这个问题让我纠结了非常 ...

  10. ZooKeeper 单机版安装和配置

    Zookeeper 下载链接:http://mirrors.shu.edu.cn/apache/zookeeper/ #wget https://mirrors.tuna.tsinghua.edu.c ...