私は、RelativeLayoutを介してビューを動的に配置するカスタムダイアログを作成しました。ダイアログが表示されるたびに、すべての子ビューが表示されますが、上部に説明できないスペースがあります。これはダイアログの「タイトル」(私にはありません)用に予約されていると思います。そのスペースを削除して、カスタムダイアログに入力するコンテンツをラップさせる方法はありますか?
レイアウトのxmlは次のとおりです。
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/handlay"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
ちなみに、相対レイアウトを親ノードにするだけで、同じ結果が得られました。
これがカスタムダイアログの.javaです。
public class HandResults extends Dialog implements DialogInterface {
HandResults hr;
Timer myTimer;
RelativeLayout handrl;
// constructor sets the layout view to handresult layout
public HandResults(Context context) {
super(context);
setContentView(R.layout.handresults);
hr = this;
}
// create a timer to remove the dialog after 3 seconds
public void showHands(){
this.show();
myTimer = null;
myTimer = new Timer();
myTimer.schedule(new TimerTask() {
@Override
public void run() {
hr.cancel();
}
}, 3000);
}
}
これが私がダイアログを呼び出す方法です:
HandResults mhr = new HandResults(this);
mhr.showHands();
何をするか、レイアウトファイルをどのように変更するかに関係なく、常にそのバッファが一番上にありますが、どうすればそれを取り除くことができますか?