style=@android:style/buttonbar,Setting style=?android:attr/buttonBarStyle to parent layout and s...
I followed Android recommendation and set style="?android:attr/buttonBarStyle" to parent layout and style="?android:attr/buttonBarButtonStyle" to buttons.
So now my layout is something like this:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
style="?android:attr/buttonBarStyle">
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 1"
style="?android:attr/buttonBarButtonStyle"/>
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 2"
style="?android:attr/buttonBarButtonStyle"/>
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 3"
style="?android:attr/buttonBarButtonStyle"/>
But after setting the style, these buttons have become invisible, although I can still click on them.
Please tell me what is wrong.
Edit: Additional details
Well, I've just created a new project specifically to test this layout and surprisingly it indeed does work.
So to be more precise, actually, I dynamically add this layout to another one, something like this:
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:id="@+id/buttons_panel_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
Code:
LayoutInflater layoutInflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout buttonsPanelContainer = (LinearLayout) findViewById(R.id.buttons_panel_container);
View buttonPanelView = null;
if(chosenValueType.equals("some_type")) {
buttonPanelView = layoutInflater.inflate(R.layout.some_buttons_panel, null);
Button Button1 = (Button) buttonPanelView.findViewById(R.id.button1);
Button1.setOnClickListener(this);
Button Button2 = (Button) buttonPanelView.findViewById(R.id.button2);
Button2.setOnClickListener(this);
} else if (chosenRawValueType.equals("another_type") {
//...
ViewGroup insertPoint = (ViewGroup) buttonsPanelContainer;
insertPoint.addView(buttonPanelView, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
Sorry to not mention it earlier, I didn't think it could be the case.
So what's wrong?
style=@android:style/buttonbar,Setting style=?android:attr/buttonBarStyle to parent layout and s...相关推荐
- 【Android UI】theme style
背景 最近在整一个前辈留下的老代码,里面有个自定义弹窗dialog, 然后自定义了一个Theme,有点看不懂,并且不用这个Theme 整个窗口弹出就出问题了. 回忆theme style 的区别和作用 ...
- android导入项目出现style错误,menu错误
android导入项目出现style错误,menu错误 style //查看 res/values/styles.xml 下的报错点.<style name="AppBaseTheme ...
- android UI进阶之style和theme的使用
今天来和大家分享一下android中UI设计里面常会用到的style和theme. 首先,style和theme都是资源,android提供了很多这样的默认资源.你可以来使用它们.同时你也可以自己定义 ...
- Android将ButtonBar放在屏幕底部
ButtonBar的方式写底部button,试了试,看起来外观貌似比Tab好看,不过恐怕没有Tab管理Activity方便吧,毕竟一个Tab就是一个Activity,但是这样用Button的话,却并不 ...
- android wifi热点setting
目录 一.wifi原生setting的入口在WifiTetherSettings.java 二.改热点Setting的时候可以直接只编译Settings.apk,并且替换, 三.wifi热点貌似官方支 ...
- 【Neural Style Transfer】 Fast Neural Style
上周写了深度学习与艺术--画风迁移 Neural Style的文章,这周就来聊一聊Fast Neural Style,从名字可以看出,Fast Neural Style的最大的特色就是快,也就是说如果 ...
- 菜鸟学Android源码——Setting(1)
菜鸟学Android源码--Setting(1) 在上一篇中,我简单介绍了Android源码的下载和编译,还没有下载编译源码的小伙伴请看这里:Android源码分析之--下载并编译源码 关于系统设置A ...
- UIElements开发人员指南9 样式(Style)和Unity样式表(style sheets)
样式(Style)和Unity样式表(style sheets) 每个VisualElement都包含样式属性,用于设置元素的尺寸以及元素在屏幕上的绘制方式,例如backgroundColor或bor ...
- 全面的Android studio的setting设置,
有时候,需要,需要去设置一些东西,,这个比较全面,记录一下,下次就直接找 Android studio 的setting的配置. https://blog.csdn.net/m0_37711172 ...
最新文章
- 微信小程序-控制文本只显示若干行多余隐藏
- electron调试html,electron桌面应用程序开发入门
- 一元流量参数为null_为什么牛逼的程序员都不用 “ ! = null quot; 做判空?
- vs2012搭建gtest环境
- mysql010函数使用.单行函数.多行函数
- linux 环境安装DBI和DBD_03
- python opencv最小外接矩形中心点_Opencv绘制最小外接矩形、最小外接圆
- mimemultipart java_H5提交MIME类型为multipart/form-data类型的表单,后端如何处理(比如java,.NET)?...
- myPassword
- Linux安装Diamond软件,Diamond软件比对蛋白质数据库
- COMSOL:案列应用实操教学---光电
- centos 测试get请求_centos网速测试
- Python学习笔记-数据分析-Pandas02-Dataframe
- 线性系统粗浅认识——第七次作业
- 直方图归一化因子计算公式
- 素问·金匮真言论原文
- steam进社区显示服务器错误,Steam社区显示102错误代码怎么办?为什么不能打开Steam社区?...
- 安装caffe依赖库时,出现“您希望继续执行吗? [Y/n] y 中止。”的解决办法
- 中断优先级分组与抢占优先级和响应优先级的关系
- Oracle——2.查询基本语法
热门文章
- UITableView中selectRowAtIndexPath: animated:scrollPosition滚动到指定Row
- BinaryReader 、BinaryWriter是方便用二进制方式读写int,double,string之类的数据
- 用defy来潜水最终还是挂了........
- 系统管理员易犯错误及解决方法汇总
- 把window中换行符(^M)改为linux的换行符(\r)
- java singleton 多线程_Java创建线程安全的单例singleton
- mysql删除重复文章标题_MySQL中查询、删除重复记录的方法大全
- Java删除文件夹和文件
- JSP怎么将表单提交到对应的servlet
- 动态添加综合布局---动态添加控件及将某XML动态加入到Activity显示(续)