在 Android 中,您可以使用以下方法来调整自定义 Dialog 中标题栏的高度:
在布局文件中为自定义 Dialog 的标题栏设置布局高度。
例如:
<LinearLayout
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#FF0000"
android:orientation="horizontal">
<!-- Title text -->
<TextView
android:id="@+id/title_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
使用自定义 Dialog 的 setContentView() 方法设置布局。
例如:
CustomDialog dialog = new CustomDialog(this);
dialog.setContentView(R.layout.custom_dialog);
在代码中使用 Dialog 的 getWindow() 方法设置标题栏高度。
例如:
CustomDialog dialog = new CustomDialog(this);
dialog.getWindow().setLayout(width, height);
请注意,在上述方法中,您需要使用 dp 或 sp 单位来设置标题栏高度,而不能使用 "px" 单位。