這對我的作品
你的主題:
<resources>
<style name="MyDialog" parent="android:Theme.Holo.Dialog">
.......
</style>
</resources>
您的自定義對話框類:
public class CustomDialog extends Dialog
{
public CustomDialog(Context context, int theme) {
super(context, theme);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...........
Resources res = getContext().getResources();
int titleId = res.getIdentifier("title", "id", "android");
View title = findViewById(titleId);
if (title != null) {
title.getLayoutParams().height = 5; // your height
}
}
}
創建對話框並顯示在您的r代碼:
CustomDialog customDialog = new CustomDialog(this, R.style.MyDialog);
customDialog.show();
試試「android:layout_height」? – SnowyTracks