我只想将我的设计视为底部导航视图,因此我通过设置tools:showIn="bottom_navigation_view"在menu.xml文件上尝试了以下操作,但它对我的设计视图选项卡没有任何影响
我不想要的菜单视图的图像
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="bottom_navigation_view">
<item
android:id="@+id/navigation_home"
android:icon="@drawable/ic_home_black_24dp"
android:title="@string/title_home" />
<item
android:id="@+id/navigation_dashboard"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="@string/title_dashboard" />
<item
android:id="@+id/navigation_notifications"
android:icon="@drawable/ic_notifications_black_24dp"
android:title="@string/title_notifications" />
</menu>
Run Code Online (Sandbox Code Playgroud)
所以请建议我这样一个有价值的工具:showIn可以工作。
android android-layout android-xml android-menu android-tools-namespace
我正在尝试使用 OkHttp 通过使用拦截登录到 Crashlytics,因为我的一些客户收到 500 错误,我想完成他们发布的内容和在响应中获得的详细信息。就像 Android Studio 的日志中显示的 OkHttp 一样。
当发生 200 错误但没有成功时,我尝试记录详细信息。
@Module
public class DIModule {
MyApplication application;
public DIModule(MyApplication application) {
this.application = application;
}
public DIModule()
{
}
@Singleton
@Provides
OkHttpClient getOkHttpClient() {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
return new OkHttpClient.Builder()
.addInterceptor(logging).addInterceptor(new HeaderInterceptor())
.build();
}
@Singleton
@Provides
Retrofit getRetro(OkHttpClient client) {
return new Retrofit.Builder()
.baseUrl(Api.BASE_URL)
.client(client)
.addConverterFactory(GsonConverterFactory.create()) //Here we are using the GsonConverterFactory to directly convert json data to object
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build();
}
@Singleton …Run Code Online (Sandbox Code Playgroud) 我想在Button上添加呼叫图标,但 drawableTop 不起作用。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp">
<Button
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:drawableTop="@android:drawable/ic_menu_call"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我正在学习 React js 并想知道,可以通过组件的引用添加点击处理程序。
我尝试跟随,但没有用
import React, { Component } from 'react'
export default class RefsDemo extends Component {
constructor(props) {
super(props)
this.inputRef=React.createRef();
this.buttonRef=React.createRef();
}
componentDidMount()
{
console.log(this.buttonRef);
this.buttonRef.current.onClick=()=>this.abchandle()
}
abchandle()
{
alert('hi');
}
render() {
return (
<div>
<button ref={this.buttonRef} >click</button>
</div>
)
}
}
Run Code Online (Sandbox Code Playgroud) android ×3
android-menu ×1
android-xml ×1
crashlytics ×1
javascript ×1
okhttp ×1
reactjs ×1
retrofit2 ×1
rx-java ×1