wuhenzhizao / android-titlebar Goto Github PK
View Code? Open in Web Editor NEW🔥 通用,功能全面的自定义标题栏,支持沉浸式标题栏,颜色渐变,miui9
🔥 通用,功能全面的自定义标题栏,支持沉浸式标题栏,颜色渐变,miui9
直接clone的项目,在xml里面不能预览该控件,我不知道是不是只有我是这样,还是说这个库本来就这样。
不知道是不是AS的版本问题,我用的3.0.1版本,您的titlebar代码都会报错:Turn off custom view rendering sandboxExec access not allowed during rendering (getprop)。不过这并不影响正常使用。
另一个是使用了ViewPager+Fragment的Activity中无法监听点击事件的问题:我测试的手机是android 8.0的小米6手机。主要的布局是这样的:
<com.wuhenzhizao.titlebar.widget.CommonTitleBar />
<android.support.v4.view.ViewPager/> //这里用的是您的activity_lauch.xml里的代码
<android.support.design.widget.BottomNavigationView/>
如果把titlebar放进每个fragment对应的子布局里的话,可以监听到右边的textview的点击事件,中间的还是会失灵。
以上的只是我的个人所见,感谢您的代码。
求大神帮助解决解决,谢谢
做成单独的控件,这样可以更好的扩展。也可以减少自定义类的方法数,从而可以在as中预览界面。
当设置为沉浸式标题栏时,标题栏文字不能自动上下居中,并且有留白空间。
titlebar:fillStatusBar="true"
titlebar:statusBarColor="@color/black"
<com.wuhenzhizao.titlebar.widget.CommonTitleBar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
titlebar:titleBarColor="@color/white"
titlebar:fillStatusBar="true"
titlebar:statusBarColor="@color/black"
titlebar:showBottomLine="true"
titlebar:bottomLineColor="@color/colorWave"
titlebar:centerType="textView"
titlebar:centerSearchRightType="delete"
titlebar:centerText="总数(0)"
titlebar:centerTextColor="@color/black"
titlebar:rightType="imageButton"
titlebar:rightImageResource="@drawable/comm_titlebar_search_normal" />
请问怎么在代码里设置各种type接口? 和CoordinatorLayout一起使用 导致CoordinatorLayout滑动隐藏控件失效 还有能否控制不用沉浸式
能否将大部分由xml定义的属性开成protected呢?这样在需要大量重复titlebar的时候可以直接继承一个新类而不是复制粘贴大量xml代码,可拓展性更强
java.lang.ClassCastException: com.android.layoutlib.bridge.android.BridgeContext cannot be cast to
android.content.ContextWrapper at
com.wuhenzhizao.titlebar.widget.CommonTitleBar.getWindow(CommonTitleBar.java:645) at
com.wuhenzhizao.titlebar.widget.CommonTitleBar.setUpImmersionTitleBar(CommonTitleBar.java:627)
at com.wuhenzhizao.titlebar.widget.CommonTitleBar.onAttachedToWindow(CommonTitleBar.java:623)
at android.view.View.dispatchAttachedToWindow(View.java:17445) at
android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at
android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3333) at
android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3333) at
android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3333) at
android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:42) Copy stack to clipboard Tip: Try to refresh the layout.
在布局的时候出现了这个是咋回事?
布局中存在EditText 输入法无法自动弹出 CommonTitleBar获取了焦点?
作者你好,使用你这个titbar后屏幕底部始终有个白底,白底的高度就是状态栏的高度。
目前魅蓝 m3,金立m6上会出现这个问题。系统版本都是5.0的,请提示下处理思路。
我搜索框输入后extra没返回我输入的内容啊
怎么设置标题栏文字 没看到相关api
centerType定义为searchView后文字无法修改?必须使用自定义控件吗?
机型:红米HM1
版本:android 4.2.1
问题原因:在OSUtils.getProp()方法中,有io操作,主线程耗时超过5s
作者你好,你这titbar背景只能给颜色值,如何扩展可以给一张渐变背景图或者渐变shape成为背景,有什么方便快速的建议吗?谢谢
群主,请问控件是否可以增加支持阿拉伯语从右到左的布局方式呢,
如果不行的话,请问我该怎么做呢
Dear Sir,
Thanks so much for this great library...
When using SmartTablayout into center which have 4 tabs images , and using right customview with 2 buttons , images are overlapping , as per attached screenshot. Do you have any recommendations ?
非常感谢这个伟大的图书馆......
当SmartTablayout使用具有4个选项卡图像的中心,并使用具有2个按钮的右侧自定义视图时,图像重叠,如附加的屏幕截图所示。你有什么建议 ?
文档中没有提及
目前跑马灯是根据屏幕宽度实现的,如果左侧右侧view过宽,中间标题就会覆盖两侧view,希望能自己设置出现跑马灯的时机。感谢作者
状态栏文字颜色怎么更改 没找到这个api
刘海屏幕如何适配,在使用小米手机刘海屏的过程中,出现适配问题
难道要把所有属性写上去 这个效果才能实现?
关闭跑马灯是时标题太长增加省略号,这样好看些
Dear Sir,
How Can I change the titlebar centerType from Text to Search View at run time programmatically.
I need to change centertype , eg to searchText instead of Text.
Thanks.
请问,有没有提供动态设置centerText的函数,发现好像只能在xml中通过titlebar:centerText="string" 设置
KeyboardConflictCompat 类名小写,但是文件名是KeyBoardConflictCompat,引起编译错误
1、沉浸模式下
2、 红米1s(miui8.5) 和oppo A37m(ColorOS3.0)Android5.1下
3、界面有ScrollView下内嵌有EditText。
Activity 设置:android:windowSoftInputMode="stateHidden|adjustResize"
已经调用
@OverRide
public void onAttachedToWindow() {
super.onAttachedToWindow();
KeyboardConflictCompat.assistWindow(getWindow());
}
当进入界面时,界面底部出现白条,高度=状态栏高度
调试发现:
KeyboardConflictCompat.KeyboardConflictCompat() 方法里面
代码
contentHeight = mChildOfContent.getHeight();
假设手机 h=1280px。
在出问题的机型里面,contentHeight = h - statusHeight
没有出现白条的手机,contentHeight = h
我把代码改为:
mChildOfContent.getRootView().getHeight();
都正常。
原因可能某些机型ROM有问题。
我在小米2s(MIUI9.2) 及其它厂商手机上(测试了10手机左右),未见有此现象。
在一个5.0的华为上试的
想要动态改变标题栏的值 ,封装代码并没有改变tvCenter方法
控制不了中间自定义视图的宽度,中间视图宽度不定,会覆盖到左右视图,如何解决
ActionBar mActionBar = getSupportActionBar();
View actionbarView =getLayoutInflater().inflate(R.layout.title,null);
// ActionBar.LayoutParams layoutParams =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT,
// ActionBar.LayoutParams.MATCH_PARENT);
ActionBar.LayoutParams layoutParams =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT,
ActionBar.LayoutParams.MATCH_PARENT);
layoutParams.gravity = Gravity.CENTER_HORIZONTAL |Gravity.CENTER_HORIZONTAL;
mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
mActionBar.setDisplayShowHomeEnabled(false);
mActionBar.setDisplayShowCustomEnabled(true);
mActionBar.setDisplayShowTitleEnabled(false);
mActionBar.setCustomView(actionbarView, layoutParams);
Toolbar parent =(Toolbar) actionbarView.getParent();
parent.setContentInsetsAbsolute(0,0);
按照说明设置,没有字体显示,api 26.1.0
请教下 app:centerSearchEditable="false" 下点击 ACTION_SEARCH 仍然失效
顶部导航栏,是图片的话,怎么使用???
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
是否多余,能否对低版本兼容,去掉他
作者你好!我偶然间发现这个标题栏,感觉非常好用,感谢您开源出这个东西。但是我阅读了readme,发现您并没有提供使用方式,例如gradle的compile。请问这是直接下载源码拷贝?我感觉这是比较麻烦的,还希望作者能够明确给出使用方式。再次万分感谢!
demo如果在Android4.4中运行,报错java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
尝试修复:将v19/styles.xml中的AppTheme定义从parent="android:Theme.Holo.Light.NoActionBar.TranslucentDecor"
改成parent="AppTheme.Base"
,运行以后发现titlebar直接顶着头部,没有留出statusbar的高度空间。
当然fitsSystemWindows=true以后可以解决这个问题,但是对其他版本又会造成影响。
请问如何处理?
如下布局,EditText包含在ScrollView中,但弹出软键盘时同样把TitleBar顶上去了?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout>
<com.wuhenzhizao.titlebar.widget.CommonTitleBar/>
<ScrollView>
...
<EditText>
....
</<ScrollView>
</LinearLayout>
我想在右侧自定义一个扫一扫自定义布局,如何响应事件?
群主,看了您的源码,有个地方不是很明白,
在处理沉浸式的时候,viewStatusBarFill 布局是如何放到状态栏上面呢,
放到状态栏上面的布局为什么不会影响状态栏的显示呢
if (fillStatusBar && supportStatusBarLightMode) {
int statusBarHeight = AppUtils.getStatusBarHeight(context);
viewStatusBarFill = new View(context);
viewStatusBarFill.setId(AppUtils.generateViewId());
viewStatusBarFill.setBackgroundColor(statusBarColor);
LayoutParams statusBarParams = new LayoutParams(MATCH_PARENT, statusBarHeight);
statusBarParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
addView(viewStatusBarFill, statusBarParams);
}
android.view.InflateException: Binary XML file line #0: Error inflating class
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.