我试图禁用用户拖动BottomSheet.我想禁用的原因是两件事.1.它阻止ListView向下滚动,2.我不希望用户使用拖动但是使用按钮来解除BottomSheetView.这就是我所做的
bottomSheetBehavior = BottomSheetBehavior.from(bottomAnc);
bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
if (newState == BottomSheetBehavior.STATE_EXPANDED) {
//Log.e("BottomSheet", "Expanded");
} else if (newState == BottomSheetBehavior.STATE_COLLAPSED) {
//Log.e("BottomSheet", "Collapsed");
}
}
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
// React to dragging events
bottomSheet.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = MotionEventCompat.getActionMasked(event);
switch (action) {
case MotionEvent.ACTION_DOWN:
return false;
default:
return true;
} …Run Code Online (Sandbox Code Playgroud) 我写了一个自定义ViewPager禁用Swipe Scroll,但我想以编程方式滑动.Tab我的视图寻呼机中有三个,但是当我viewPager.setCurrentItem(viewPager.getCurrentItem()+1)第一个呼叫时Fragment,它会移动到第三个Fragment而不是第二个Fragment.如果我在第二个中调用相同的函数Fragment,则会转到第三个函数.如果我在第三个片段中调用(viewPager.getCurrentItem() - 1)`,它可以通过向后移动来正常工作.任何帮助,将不胜感激.我的代码如下:
NonSwipeAbleViewPager
public class NonSwipeableViewPager extends ViewPager {
private boolean swipeable;
public NonSwipeableViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MyViewPager);
try {
swipeable = a.getBoolean(R.styleable.MyViewPager_swipeable, true);
} finally {
a.recycle();
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return swipeable ? super.onInterceptTouchEvent(event) : false;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return swipeable ? super.onTouchEvent(event) : false; …Run Code Online (Sandbox Code Playgroud) 我想inject dependencies进入我的应用程序.一切都很好,直到我试着注入Realm我的Service班级.我开始得到IllegalStateException这显然是由我Realm从Thread它创建的访问引起的.所以,这是我的结构Dependency Injection
AppModule
@Module
public class AppModule {
MainApplication mainApplication;
public AppModule(MainApplication mainApplication) {
this.mainApplication = mainApplication;
}
@Provides
@Singleton
MainApplication getFmnApplication() {
return mainApplication;
}
}
Run Code Online (Sandbox Code Playgroud)
RequestModule
@Module
public class RequestModule {
@Provides
@Singleton
Retrofit.Builder getRetrofitBuilder() {
return new Retrofit.Builder()
.baseUrl(BuildConfig.HOST)
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create(CustomGsonParser.returnCustomParser()));
}
@Provides
@Singleton
OkHttpClient getOkHttpClient() {
return new OkHttpClient.Builder()
.addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BASIC))
.connectTimeout(30000, TimeUnit.SECONDS)
.readTimeout(30000, TimeUnit.SECONDS).build();
}
@Provides
@Singleton
Retrofit getRetrofit() {
return …Run Code Online (Sandbox Code Playgroud) 我试图在其中Long使用价值,Android Databinding但无法使其发挥作用。这就是我尝试过的一切
1:效果很好。直到我开始对棒棒糖之前的产品进行测试并且开始遇到崩溃。我不得不android:addTextChangedListener="@{outlet.onCapacityChange}"从XML中删除它
Java
@SerializedName("capacity")
@Expose
Long capacity
/**
*
* @return
* The capacity
*/
@Bindable
public Long getCapacity() {
return capacity;
}
/**
*
* @param capacity
* The capacity
*/
public void setCapacity(Long capacity) {
setAtomicCapacity(capacity);
Log.e(TAG+"Capacity", "" + capacity);
notifyPropertyChanged(BR.capacity);
}
public void setAtomicCapacity(Long basic) {
this.capacity = basic;
}
public TextWatcher onCapacityChange = new SimpleTextWatcher() {
@Override
public void onTextChanged(String newValue) {
Log.e(TAG+"Capacity", newValue);
setAtomicCapacity(Long.valueOf(newValue));
}
};
XML
<EditText …Run Code Online (Sandbox Code Playgroud) 我试图让Viper读取我的环境变量,但它无法正常工作.这是我的配置:
# app.yaml
dsn: RESTFUL_APP_DSN
jwt_verification_key: RESTFUL_APP_JWT_VERIFICATION_KEY
jwt_signing_key: RESTFUL_APP_JWT_SIGNING_KEY
jwt_signing_method: "HS256"
Run Code Online (Sandbox Code Playgroud)
我的config.go档案:
package config
import (
"fmt"
"strings"
"github.com/go-ozzo/ozzo-validation"
"github.com/spf13/viper"
)
// Config stores the application-wide configurations
var Config appConfig
type appConfig struct {
// the path to the error message file. Defaults to "config/errors.yaml"
ErrorFile string `mapstructure:"error_file"`
// the server port. Defaults to 8080
ServerPort int `mapstructure:"server_port"`
// the data source name (DSN) for connecting to the database. required.
DSN string `mapstructure:"dsn"`
// the signing method for …Run Code Online (Sandbox Code Playgroud) 我试图实现一个我在草图上嘲笑的观点.我在Android上复制了它,因为我在这个平台上非常好.我在iOS上很擅长,但UI是我的弱点.
我扩展了一个UIViewController和我的StoryBoard有顶部是一个视图,底部是一个tableview.我遇到的问题是UITableViewCell在应用程序本身中看起来像这样.以下是我尝试过的解决方案.但是,它只是把它全部挤到了顶端.NB.我用UIView它画出那些小小的线条UITableViewCell
func configureTableView() {
//First One I tried then later commented it out
loanStateTable.rowHeight = UITableViewAutomaticDimension
loanStateTable.scrollToNearestSelectedRowAtScrollPosition(UITableViewScrollPosition.Middle, animated: true)
//Second One I tried
var edgeInset = UIEdgeInsets(top: 16, left: 16, bottom: 0, right: 16)
loanStateTable.contentInset = edgeInset
}
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激.谢谢
输出:
从我的表中的一列中,我想获得这些列中值类型的总和计数。例如,一列是:
|paymentGateway |
---------------
| Paystack |
| Flutterwave |
| NIBSS |
| PAGA |
| Interswitch |
| Paystack |
| Flutterwave |
| NIBSS |
| PAGA |
| Interswitch |
| Paystack |
| Flutterwave |
| NIBSS |
| PAGA |
| Interswitch |
Run Code Online (Sandbox Code Playgroud)
我运行了查询Progress DB Viewer,它工作正常。这是查询:
SELECT
"paymentGateway",
SUM(1) FILTER (WHERE "paymentGateway" = 'Paystack') AS paystack,
SUM(1) FILTER (WHERE "paymentGateway" = 'NIBSS') AS nibss,
SUM(1) FILTER (WHERE "paymentGateway" = 'Flutterwave') AS flutterwave, …Run Code Online (Sandbox Code Playgroud) 我试图将更新发送到我Activity从我的GCMServiceListener话,我使用RxJava/RxAndroid并创建一个BusClass用于处理和发送Observers
public class ClientBus {
//private final PublishSubject<Object> _bus = PublishSubject.create();
// If multiple threads are going to emit events to this
// then it must be made thread-safe like this instead
private final Subject<Object, Object> _bus = new SerializedSubject<>(PublishSubject.create());
public void send(Object o) {
_bus.onNext(o);
}
public Observable<Object> toObserverable() {
return _bus;
}
public boolean hasObservers() {
return _bus.hasObservers();
}
}
Run Code Online (Sandbox Code Playgroud)
而在我,Application Class我这样做初始化BusClass
private ClientBus clientBus;
public …Run Code Online (Sandbox Code Playgroud) android ×5
dagger-2 ×1
go ×1
ios ×1
node.js ×1
postgresql ×1
realm ×1
rx-android ×1
sequelize.js ×1
swift ×1
uitableview ×1
viper-go ×1