当前位置:网站首页>CommonTitleBar hide left right
CommonTitleBar hide left right
2022-07-27 07:55:00 【Kamchatka Bear Man】
CommonTitleBar Is a good custom top bar control , Meet a need , Same page , According to the fields returned by the server , Determine whether a button in the top bar is displayed or hidden ,true and false.
For this need , Write a simple demo, To achieve this effect
step1:
package com.uxdpen.ui.android.activity.examples;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import com.uxdpen.ui.android.R;
import com.wuhenzhizao.titlebar.widget.CommonTitleBar;
public class TitlebarActivity extends AppCompatActivity {
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.content_left_text);
final CommonTitleBar titleBar = (CommonTitleBar) findViewById(R.id.titlebar);
titleBar.getLeft();
TextView mTextView = titleBar.getLeftTextView();
TextView mTextView2 = titleBar.getRightTextView();
View view = titleBar.getLeftCustomView();//.setVisibility(View.INVISIBLE);
mTextView.setVisibility(View.INVISIBLE);
mTextView2.setVisibility(View.VISIBLE);
System.out.println(mTextView);
titleBar.setListener(new CommonTitleBar.OnTitleBarListener() {
@Override
public void onClicked(View v, int action, String extra) {
if (action == CommonTitleBar.ACTION_LEFT_BUTTON || action == CommonTitleBar.ACTION_LEFT_TEXT) {
Log.e("TAG", " test ");
} else if (action == CommonTitleBar.ACTION_RIGHT_BUTTON || action == CommonTitleBar.ACTION_RIGHT_TEXT) {
Log.e("TAG", " details ");
}
}
});
titleBar.setDoubleClickListener(new CommonTitleBar.OnTitleBarDoubleClickListener() {
@Override
public void onClicked(View v) {
Log.e("TAG", " Wind speed reaches yes ");
}
});
}
}
step2:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:titlebar="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_red_light"
android:fitsSystemWindows="false"
android:orientation="vertical"
tools:context="com.uxdpen.ui.android.activity.examples.TitlebarActivity">
<com.wuhenzhizao.titlebar.widget.CommonTitleBar
android:id="@+id/titlebar"
android:layout_width="match_parent"
android:layout_height="60dp"
titlebar:centerText=" The title bar "
titlebar:centerType="textView"
titlebar:fillStatusBar="true"
titlebar:leftDrawable="@drawable/comm_titlebar_back_normal"
titlebar:leftDrawablePadding="0dp"
titlebar:leftText=" return "
titlebar:rightText=" details "
titlebar:leftType="textView"
titlebar:rightType="textView" />
</LinearLayout>
step3:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.wuhenzhizao:titlebar:1.0.6'
}
end
边栏推荐
- Primary key in MySQL secondary index - MySQL has a large number of same data paging query optimization
- 浅谈数据安全
- Methods of server network testing
- Lu Xun: I don't remember saying it, or you can check it yourself!
- What is the real HTAP? (2) Challenge article
- 一体化实时HTAP数据库StoneDB,如何替换MySQL并实现近百倍分析性能的提升
- 物联网工业级UART串口转WiFi转有线网口转以太网网关WiFi模块选型
- 【Golang】golang开发微信公众号网页授权功能
- 瑞芯微RK3399-I2C4挂载EEPROM的修改案例
- Day111. Shangyitong: integrate nuxt framework, front page data, hospital details page
猜你喜欢

将对象转换为键值对

Internet of things industrial UART serial port to WiFi to wired network port to Ethernet Gateway WiFi module selection

C language programming | program compilation and preprocessing

孙子出题难,儿子监考严。老子不会做,还我上学钱

Zero training platform course-1. SQL injection Foundation

How to update PIP3? And running PIP as the 'root' user can result in broken permissions and conflicting behavior

Grandson's questions are difficult, and his son's invigilation is strict. I can't do it. Pay back my school money

Comprehensive analysis of ADC noise-01-types of ADC noise and ADC characteristics

SETTA 2020 国际学术会议即将召开,欢迎大家参加!

物联网工业级UART串口转WiFi转有线网口转以太网网关WiFi模块选型
随机推荐
【万字长文】吃透负载均衡,和阿里大牛的技术面谈
CommonTitleBar hide left right
Things come to conform, the future is not welcome, at that time is not miscellaneous, neither love
What about idea Chinese garbled code
擎创科技加入龙蜥社区,共建智能运维平台新生态
增强:BTE流程简介
What other methods are available for MySQL index analysis besides explain
mqtt指令收发请求订阅
Framework of electronic mass production project -- basic idea
Zero training platform course-1. SQL injection Foundation
存储过程与函数
如何获取广告服务流量变现数据,助力广告效果分析?
Comprehensive cases
将对象转换为键值对
正则 和 sed 练习
【飞控开发基础教程4】疯壳·开源编队无人机-串口(光流数据获取)
How to get DDL information of an object
What is the real HTAP? (2) Challenge article
国内首款开源MySQL原生HTAP数据库即将发布!三大亮点抢先看,限量周边等你来~
【小程序】如何获取微信小程序代码上传密钥?