我一直想知道如何设置padding-bottom(自定义CSS)来使用RemoteConfig(有URL)中的网页。我无权访问网页,因此无法直接在源文件中对其进行编辑。
这是我的代码:
public class PlayoffsFragment extends BaseFragment {
private WebView webView;
public static PlayoffsFragment newInstance(Bundle args) {
PlayoffsFragment fragment = new PlayoffsFragment();
fragment.setArguments(args);
return fragment;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_playoffs, container, false);
setActionBar();
setViews();
setViewContents();
return rootView;
}
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
hideCalendarMenuItem();
}
@Override
protected void setActionBar() {
showActionBar();
setContentMarginOff();
changeToolbarBackground(R.color.transparent);
changeToolbarIconsColor(ContextCompat.getColor(getContext(), R.color.white)); }
@Override
protected void setViews() {
webView = rootView.findViewById(R.id.webview);
webView.setWebViewClient(new WebViewClient());
webView.setWebChromeClient(new WebChromeClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setDatabaseEnabled(true);
webView.getSettings().setMinimumFontSize(1);
webView.getSettings().setMinimumLogicalFontSize(1);
}
@Override
protected void setViewContents() {
webView.loadUrl(BuildConfig.WEB_URL);
}
}
答案 0 :(得分:0)
好吧,我设法做到了。对于任何想要做类似事情的人,下面是我更新的代码:
// Helper fn
const logArg = val => console.log(`Previous value ${val}`);
const logName = fn => console.log(`Fn ${fn.name.replace('bound ', '')} called`);
// Fn a returns Boolean
const a = () => true;
// Fn b returns Void (undefined)
const b = previousResult => { logArg(previousResult); };
// Fn c returns Promise<Number>
const c = previousResult => new Promise(resolve => {
logArg(previousResult);
resolve(10);
});
// Fn d returns String - but is called last so the result isn't passed anywhere
const d = previousResult => {
logArg(previousResult);
return '10';
};
function runInSequence (...fns) {
const fn = fns[0];
const result = fn();
logName(fn);
if (fns.length === 1) {
return;
} else if (result instanceof Promise) {
// If function returns a Promise, wait for it to be resolved
result.then(value => runInSequence(
fns[1].bind(null, value),
...fns.slice(2),
));
} else {
// Otherwise just continue
runInSequence(
fns[1].bind(null, result),
...fns.slice(2),
);
}
}
runInSequence(
a,
b,
c,
d,
);
我已经在Assets文件夹中创建了styles.css。