toolbar

WebView 使用Android 原生ToolBar

匿名 (未验证) 提交于 2019-12-03 00:22:01
在使用 WebView 加载 H5 页面的时候,很多H5页面会有自己的标题栏,然而原生APP中也会有自己的标题栏。很多应用为保证标题栏风格与原生应用统一,或者保证返回键的使用能自由控制,选择使用原生的 ToolBar 来作为页面的标题栏。 为避免出现两个标题栏,需要隐藏H5自带的标题栏; 原生标题栏需要显示 H5 标题栏中的标题 以一个网页为例: http://m.ly.com/interCarTouch/view/main.html?from=groupmessage#/pickupSearch?refid=500270222 通过分析这个网页的源码,我们可以看到网页的标题栏是一个 class 名为 fed-navbar 的div,内部包含一个返回箭头和一个 h1 标题”用车“。我们要做的,就是找到这个div,并且隐藏。 如上图,在Chrome浏览器中,我们,可以通过 document.getElementsByClassName(“fed-navbar”)[0] 方法来拿到class名为 fed-navbar 的元素,并且通过设置其 style.display=”none” 来隐藏该元素。 document.getElementsByClassName("fed-navbar")[0].style.display="none" 在Android中,无法直接调试H5,但是可以在

原生JS实现简单富文本编辑器2

匿名 (未验证) 提交于 2019-12-02 23:59:01
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>原生JS实现简单富文本编辑器</title> </head> <body> <center> <h2 style="margin:auto;">原生JS实现简单富文本编辑器</h2> </center> <hr> <div id="toolbar" style="width:700px;margin:auto;border:2px solid gray;padding: 5px;overflow: auto;font-family: 'Courier New', Courier, monospace;"> <input type="button" name="bold" value='加粗' class="bold"> <input type="button" name="italic" value='斜体' class="italic"> <input type="button" name=

NavigationView

匿名 (未验证) 提交于 2019-12-02 23:40:02
NavigationView 一、效果图 二、代码示例 一、效果图 二、代码示例 //头部局布局文件 < ? xml version = "1.0" encoding = "utf-8" ? > < LinearLayout xmlns : android = "http://schemas.android.com/apk/res/android" android : layout_width = "match_parent" android : layout_height = "wrap_content" android : orientation = "vertical" > < ImageView android : layout_width = "match_parent" android : layout_height = "wrap_content" android : background = "@drawable/ic_launcher_background" / > < TextView android : layout_width = "match_parent" android : layout_height = "wrap_content" android : gravity = "center" android : text = "这是头布局" / > <

安卓菜鸟

匿名 (未验证) 提交于 2019-12-02 23:40:02
NavigationView 效果图 布局文件 // An highlighted block < ? xml version = "1.0" encoding = "utf-8" ? > < LinearLayout 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 = "bw.com.day3.Main3Activity" android : orientation = "vertical" > < android . support . v7 . widget . Toolbar android : id = "@+id/tb" android : layout_width = "match_parent" android : layout_height = "80dp" android :

ToolBar间距设置

匿名 (未验证) 提交于 2019-12-02 23:03:14
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34206863/article/details/85293120 1、没有NavigationIcon 此时,contentInsetStart 会发挥作用,什么作用。就是你的自定义View左边总会多出一块空白。 为什么?看源码。 int contentInsetStart = a.getDimensionPixelOffset(styleable.Toolbar_contentInsetStart, -2147483648); int contentInsetEnd = a.getDimensionPixelOffset(styleable.Toolbar_contentInsetEnd, -2147483648); int contentInsetLeft = a.getDimensionPixelSize(styleable.Toolbar_contentInsetLeft, 0); int contentInsetRight = a.getDimensionPixelSize(styleable.Toolbar_contentInsetRight, 0); this.ensureContentInsets(); this.mContentInsets

ToolBar控件在C#开发APP中的使用方式【附案例源码】――Smobiler移动开发平台

匿名 (未验证) 提交于 2019-12-02 22:06:11
控件说明 底部工具栏控件。 效果演示 其他效果 该界面为仿淘宝UI制作的一个简单的UI模板,源码获取方式请拉至文章末尾。 特色属性 属性 属性说明 Direction(相对布局) 容器主轴方向。 Flex(相对布局) 比例因子。 Items 工具栏项集合。 SelectBackColor 选中后背景颜色。 SelectedIndex 默认选择项。 SelectForeColor 选中后字体颜色。 FontSize 字体大小。 ForeColor 字体颜色。 事件 事件 事件发生条件 ToolBarItemClick 工具栏项点击时发生。 控件使用 下文的教学内容仅针对【效果演示】中的例子 1. 设置工具栏数据 3. 设置默认选中项、选中项背景色和文字颜色 4. 在事件中,用e.Name判断当前点击按钮,来进行对应操作 private void toolBar1_ToolbarItemClick(object sender, ToolbarClickEventArgs e) { switch(e.Name) { case "Work": //按钮名称 break; } } 仿淘宝UI的源码 该源码通过基于.NET的Smobiler移动开发平台开发完成, 该源码适用Smobiler用户。 如果你刚接触smobiler,在打开该源码前,需安装smobiler

How to catch navigation icon click on toolbar from fragment?

假如想象 提交于 2019-12-02 21:44:56
I have a dialog fragment in which I have toolbar in layout. I want to make back button(Navigation Icon) working in toolbar and exit the fragment when clicked. But I am unable to catch the click event on the toolbar's navigation icon in the (dialog)fragment. Here is how I am getting toolbar : toolbar = (Toolbar) rootView.findViewById(R.id.toolbar); toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); toolbar.setTitle(itemType); ((AppCompatActivity)getActivity()).setSupportActionBar(toolbar); Here is my layout file for the dialog fragment : <?xml version="1.0" encoding="utf-8"?>

Set up toolbar as actionbar in fragment

杀马特。学长 韩版系。学妹 提交于 2019-12-02 21:41:53
I want to set up my toolbar as an actionbar, but since your toolbar is a layoutelement it has to be in your layout. Now my layout is in my fragment. I added the toolbar in my layout and I call it within my fragment: //Toolbar Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar); It works because I can set the title and so on but now I want it to react as a actionbar because I want to have this actually. setDisplayHomeAsUpEnabled(true) To do that I have to change the toolbar to an actionbar: setSupportActionBar(toolbar); That doesn't work in my fragment ... Can anybody help me

Toolbar with EditText material design

混江龙づ霸主 提交于 2019-12-02 18:12:14
I'm trying to make Toolbar with EditText within it like this: Right now I can do some thing similar but only with static title, Any ideas to get started? I have done this like below: There is Toolbar as AppBar (aka ActionBar ) at the top and second toolbar below it with two EditText . First Toolbar is under CollapsingToolbarLayout in case you want it to be collapsed. Java : public class MainActivity extends AppCompatActivity { Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar =