frag
<?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的更多相关文章
- frag General URL components
HTTP: The Definitive Guide 2.2.7 Fragments Some resource types, such as HTML, can be divided further ...
- Frag(匹配跟踪)
‘碎片’(Frag)跟踪是目标跟踪里的一种通过‘部分‘匹配识别的方法,其目标模板是通过图像多个碎片和块来描述.块是任意的,不基于目标模型的(与传统的基于’部分‘的方法不一样,比如人体的四肢与躯干的跟踪 ...
- Unity3d 镜面反射 vertex and frag Shader源代码
Unity3d 镜面反射 网上能找到的基本上是固定管道或表面渲染的shader. 特此翻译为顶点.片段渲染的Shader, 本源代码仅仅涉及shader与cs部分. Editor部分使用NGUI绘制的 ...
- Unity3d 镜面折射 vertex and frag Shader源代码
Unity3d 镜面折射 网上能找到的基本上是固定管道或表面渲染的shader. 特此翻译为顶点.片段渲染的Shader, 本源代码仅仅涉及shader与cs部分, 请自行下载NGUI unity ...
- Error loading XML document: dwz.frag.xml 处理方式
问题:直接用IE打开index.html弹出一个对话框:Error loading XML document: dwz.frag.xml 方案一(已经验证): 转自:http://blog.csdn. ...
- Grow heap (frag case) to 6.437MB for 1114126-byte allocation
本篇文章是对Grow heap (frag case) 堆内存过大的问题进行了详细的分析介绍,需要的朋友参考下 对于Android开发者来说虽然使用了可以自动管理内存的Java语言,但是对于内存管理不 ...
- Vertex&Frag
一.Vertex&Frag 包含Vertex&Fragment 的Shader叫做顶点&像素着色器,在Vertex的功能函数中,我们侧重于几何计算,如纹理坐标,顶点坐标等:在F ...
- CSharpGL(33)使用uniform块来优化对uniform变量的读写
CSharpGL(33)使用uniform块来优化对uniform变量的读写 +BIT祝威+悄悄在此留下版了个权的信息说: Uniform块 如果shader程序变得比较复杂,那么其中用到的unifo ...
- 原生JS实现-星级评分系统
今天我又写了个很酷的实例:星级评分系统(可自定义星星个数.显示信息) sufuStar.star();使用默认值5个星星,默认信息 var msg = [........]; sufuStar.sta ...
随机推荐
- 小程序获取openid 出现null,{"errcode":40163,"errmsg":"code been used, hints: [ req_id: WNUzlA0105th41 ]"}
//根据微信提供的接口,请求得到openid和session_id public class UserInfoUtils { private String getKeyURL="https: ...
- sciense
I hate the word "networking." It must be one of the most overused words in the English lan ...
- 多线程之 Runnable接口
一.多线程实现的第二种方式 1.定义类,实现Runnable接口 2.重写接口中的run方法,要在run方法中定义线程要执行的任务 public class MyRunnableImpl implem ...
- Python标准库01正则表达式
在学习网络爬虫的过程中,需要抓取网页的评论数,涉及到正则表达式,便顺便看了看.正则表达式是文字处理中常用的工具. 1正则表达式的常用字符串 . 任何单个字符 [] 字符集对单个字符给出取值 ...
- Java的数组,集合,数据结构,算法(一)
本人的愚见,博客是自己积累对外的输出,在学习初期或自己没有多少底料的情况下,与其总结写博客不如默默去搞自己的代码,但是学到集合这一块时,数组,集合,数据结构,算法这个概念搞的我比较混淆,所以不得已写这 ...
- java 构造方法详解
构造方法(构造器) 是一种特殊的方法,该方法只有功能:构造对象 特点: 1.没有返回值 2.构造方法的名称一定和类名一致 3.不能在构造方法中写r ...
- UBUNTU 16.04 安装AVD "An error occurred while running "android create avd
安装库即可sudo apt-get install lib32stdc++6
- 原型设计软件介绍——Axure RPx
我个人使用的是Axure RP8版本 进去后的主页面(汉化版),可以看到上方功能栏,缩放大小功能,左下角则是软件内置的一些元件 我在左边的元件库中拖入了一个矩形框,定义为640*960个像素,并把矩形 ...
- Java继承2
1.为什么使用继承 从已有的类派生出新的类,称为继承. 在不同的类中也可能会有共同的特征和动作,可以把这些共同的特征和动作放在一个类中,让其它类共享. 因此可以定义一个通用类,然后将其扩展为其它多个特 ...
- 运行Office 2007安装程序提示:"找不到Office.zh-cn\OfficeMUI.xml"(转载)亲测
去网上查结果原来是Office 2007和Visual Studio 2008 Authoring Component组件相冲突,网上说用VS.Net 2008光盘WCU\WebDesignerCor ...