好吧,我几乎已经解决了这个问题(我正在回答我自己的问题,因为它可能会帮助其他人解决与我相同的问题).
问题仍然存在于纺纱厂,DatePickers等.
对于AlertDialogs,我做这样的事情:
AlertDialog.Builder builder = new AlertDialog.Builder(MyActivity.this, AlertDialog.THEME_HOLO_LIGHT);
//Then I do what I need with the builder (except for setTitle();
LayoutInflater inflater = getLayoutInflater();
View view=inflater.inflate(R.layout.dialog_custom_title, null);
TextView title = (TextView)view.findViewById(R.id.myTitle);
title.setText("Title I want to show");
builder.setCustomTitle(view);
AlertDialog alert = builder.create();
alert.show();
dialog_custom_titile.xml:
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#044592" >
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTitle"
android:layout_width="fill_parent"
android:textSize="20dp"
android:layout_height="70dp"
android:layout_marginLeft="25dp"
android:paddingTop="22dp"
android:textColor="@android:color/white"
android:textStyle="bold" />
对于我想看起来像Dialogs的活动,我喜欢这样:
我在Manifest.xml中声明它们如下:
android:name="com.aveschini.AnotherActivity"
android:screenOrientation="portrait"
android:label="My Dialog"
android:theme="@style/MyDialog"
android:windowSoftInputMode="adjustPan" />
然后,在res / values / styles.xml文件中我喜欢这样:
@style/DialogWindowTitle
@style/TextAppearance.DialogWindowTitle
#044592
@android:color/white
bold
20sp
我仍然在标题和身体之间得到浅蓝色的分隔线……仍在努力.
如前所述,我仍然不知道如何处理Spinners,DatePicker等…
这就是结果:
AlertDialog:
和一个带有对话框外观的Activity: