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 ...
随机推荐
- javaScript简单的留言板
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- Python中对字符串的操作
Python字符串的相关操作 1.字符串格式判断 s.isalnum() #所有字符都是数字或者字母 s.isalpha() #所有字符都是字母 s.isdigit() #所有字符都是数字 s.isl ...
- hosts文件被修改后的惨案
在公司MAC电脑上/etc/hosts中尝试反向解析一个ip到localhost, 即:xxx.xxx.xxx.xxx localhost 然后发现tomcat起不来;
- JavaEE第六周
Applet简介 Java Applet简介 最近要使用worldwind java sdk做Applet开发,看了些Applet的资料,为了防止忘记,记录如下: applet是通过<apple ...
- asp.net webAPI POST方法的CORS跨域问题
端口不同会判断为不同域 Method Not Allowed . web.config中设定·customHeaders 错误变化为 原因‘ post方法使用前会有一次OPTION方法的请求’ 解决: ...
- ava、Python和PHP三者的区别
Java.Python和PHP三者的区别 2017年07月15日 22:09:21 书生_AABB 阅读数:18994 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blo ...
- CKEditor的使用,并实现图片上传
ckeditor是一款富文本编辑器,类似于论坛帖子下边的回复输入框. 1.先要下载相应js文件,点我下载.根据自己的需求选择插件的丰富程度,下载后解压得到一个文件夹,放到webRoot目录下. 2.在 ...
- Python字符串与格式化的一点用法
#python的基本语法网上已经有很多详细的解释了,写在这里方便自己记忆一些 1.python于C语言不同的是,python没有字符的概念,所谓的字符就是长度为1的字符串,使用切片或者索引同样可以对字 ...
- python中filter,reduce,map的用法
filter的用法: 操作表list的内嵌函数'filter' 需要一个函数与一个list它用这个函数来决定哪个项应该被放入过滤结果队列中遍历list中的每一个值,输入到这个函数中如果这个函数返回Tr ...
- 芯片烧录器编程AT24C02
网上买了两款芯片烧录器,因为项目用的到.芯片以后的类型可能是IIC 接口的.就选则了一个IIC接口的AT24C02EEPROM.进行尝试.手头上没有这款芯片. 就想起自己单片机上有这款芯片.然后就开始 ...