私はAlertDialog
を持っており、これはカスタムダイアログビューを使用しています。カスタムタイトルビューのアイデアは十分にシンプルに見えますが、カスタムタイトルの周りに黒い境界線があり、取り除くことはできません。上辺、左辺、右辺には1ピクセルの境界線があり、下辺には約5ピクセルの境界線があります。AlertDialogカスタムタイトルに黒い境界線があります
Javaでダイアログを作成:
View titleView = inflater.inflate(R.layout.part_list_item, parent, false);
((TextView) titleView.findViewById(R.id.partName)).setText(titleText);
AlertDialog productDialog = new AlertDialog.Builder(getContext())
.setCustomTitle(titleView)
.setAdapter(adapter, doNothingClickListener)
.create();
カスタムタイトルビューのレイアウト、part_list_item.xml
:
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ff0000"
android:id="@+id/partName"
android:layout_marginLeft="6dip"
android:textAppearance="?android:attr/textAppearanceLargeInverse"
/>
私が見る何を:
私が見たいもの:
がTextViewのに必要な相対的なレイアウトと影でパディングですか..? – ngesh
@sandy公正な質問。私はこれらのビットを削除しましたが、結果は同じですが、下の黒の境界線がより大きくなった点が異なります。 –
XMLを拡張するときに 'attachToRoot'をtrueに設定しようとしてください。 – dreamtale