<?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. CSS可见区域全局居中

    top:$(document).scrollTop() + ($(document).height() - $(document).scrollTop())/2,

  2. node.js http接口调试时请求串行特性分析

    缘起: 产品业务上有个类数据库服务的请求时间比较长(类似mysql的sql查询),为了优化减少并发时的请求数,做了一个并发时共用请求的优化. 通过单元测试后,想通过手动模拟看下效果,发现优化一直不能生 ...

  3. BUG调试: Jump to the invalid address stated on the next line at 0x0: ???

    gdb或者vlagrind报告: ==14569== Jump to the invalid address stated on the next line ==14569== at 0x0: ??? ...

  4. 遇到的难题之一 —— js方法toFixd()

    工作中遇到金额需要保留两位小数的需求,单价1.265,数量为1,正常来讲金额应为1.27,用了toFixd()方法后结果为1.26. 最终找到问题所在:1.265 - 1.26 = 0.0049999 ...

  5. eclipse代码自动补全。

    打开 Eclipse -> Window -> Perferences 找到Java 下的 Editor 下的 Content Assist , 右边出现的选项中,有一个Auto acti ...

  6. 当锚点定位遇上position: fixed

    <!DOCTYPE html><html> <head> <title>当锚点定位遇上position: fixed</title> < ...

  7. Oracle学习笔记之触发器

    触发器 触发器(trigger)是一些过程,与表关系密切,用于保护表中的数据,当一个基表被修改(INSERT.UPDATE或DELETE)时,触发器自动执行,例如通过触发器可实现多个表间数据的一致性和 ...

  8. 小程序wx.chooseImage的坑

    选择图片后可能重新执行onshow()和onhide(),可以在页面中添加锁变量,选择图片前获取,选择完释放,onshow中利用锁来中断执行

  9. Java ASM 技术简介

    什么是ASM ASM 是一个 Java 字节码操控框架.它能被用来动态生成类或者增强既有类的功能.ASM 可以直接产生二进制 class 文件,也可以在类被加载入 Java 虚拟机之前动态改变类行为. ...

  10. log4j:WARN Please initialize the log4j system properly解决办法

    使用log4j,报警如下: log4j:WARN No appenders could be found for logger log4j:WARN Please initialize the log ...