我有一个带有NestedScrollView的底页(见下文).当我按下FAB按钮时,我想让这个NestedScrollView中的某些部分不可见.但是当我将一些线性布局的可见性改为GONE时,底片会从顶部飞走.看这里:
您可以从https://github.com/Tanrikut/BottomSheetExample获取整个代码
我的变更可见性方法:
private void changeVisibility() {
subtitleLayout.setVisibility(View.GONE);
coordinateLayout.setVisibility(View.GONE);
timeLayout.setVisibility(View.GONE);
}
Run Code Online (Sandbox Code Playgroud)
我的NestedScrollView xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:behavior_peekHeight="120dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
android:id="@+id/bottom_sheet_main">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="28dp"
android:background="@android:color/white"
android:animateLayoutChanges="true"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingStart="10dp"
android:paddingTop="@dimen/activity_horizontal_margin">
<TextView
style="@style/TextAppearance.AppCompat.Headline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Dandelion Chocolate"
android:id="@+id/title" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_horizontal_margin"
android:layout_marginTop="16dp"
android:orientation="horizontal"
android:id="@+id/subtitleLayout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/subtitle"
android:text="Subtitle" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/activity_horizontal_margin"
android:id="@+id/coordinateLayout">
<ImageButton
android:layout_width="24dp"
android:layout_height="24dp"
android:alpha="0.36"
android:src="@drawable/ic_room_24dp"
android:background="@null" …Run Code Online (Sandbox Code Playgroud) 在我的 React 组件之一中,我对一些自定义元素进行了以下定义:
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace JSX {
interface IntrinsicElements {
'd3fc-group': DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
'd3fc-svg': DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我返回为:
return (
<div ref={d3Container} className='main_layout' data-testid={'chart'}>
<d3fc-group
id='group'
className='hellooo'
style={{ display: 'flex', height: '100%', width: '100%', flexDirection: 'column' }}
auto-resize>
</d3fc-group>
</div>
);
Run Code Online (Sandbox Code Playgroud)
但在生成的 html 中,“className”被转换为“classname”而不是“class”属性。
<d3fc-group id="group" classname="hellooo" auto-resize="true" style="display: flex; height: 100%; width: 100%; flex-direction: column;"><div style="flex: 1 1 0%; display: flex; flex-direction: column;"></d3fc-group>
Run Code Online (Sandbox Code Playgroud)
如何让它像其他组件一样转换为“class”属性?