Android Dialog: Removing title bar

后端 未结 13 2299
醉酒成梦
醉酒成梦 2020-11-29 18:24

I have a weird behavior I can\'t pinpoint the source of.

I have my app with the classic

requestWindowFeature(Window.FEATURE_NO_TITLE);
13条回答
  •  一个人的身影
    2020-11-29 19:07

    I'm using next variant:

    Activity of my custom Dialog:

    public class AlertDialogue extends AppCompatActivity {
    
        Button btnOk;
        TextView textDialog;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(R.layout.activity_alert_dialogue);
    
            textDialog = (TextView)findViewById(R.id.text_dialog) ;
            textDialog.setText("Hello, I'm the dialog text!");
    
            btnOk = (Button) findViewById(R.id.button_dialog);
            btnOk.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    finish();
                }
            });
        }
    }
    

    activity_alert_dialogue.xml:

    
    
    
        
    
        

    Manifest:

    
    
    

    Style:

    
    

提交回复
热议问题