简体   繁体   English

android中的自定义布局

[英]Custom layout in android

i've developed an android messaging app but, i would like to change the whole layout.我开发了一个 android 消息传递应用程序,但是,我想改变整个布局。 It even includes a alert dialog which also i want to change.. help please..它甚至包括一个警报对话框,我也想更改它..请帮助..

Your layout is generally in an xml file, eg, main.xml, called with something like setContentView(R.layout.main) .您的布局通常位于 xml 文件中,例如 main.xml,使用类似setContentView(R.layout.main)的名称调用。 The main.xml file is usually in /res/layouts, and can be edited directly, independent of the Java code. main.xml文件一般在/res/layouts,可以直接编辑,独立于Java代码。

you can define custom layout in xml files and call the layout inflator service to inflate that xml file.您可以在 xml 文件中定义自定义布局,并调用布局充气器服务来充气该 xml 文件。 If you want to customize alertdialog, then do the following make a customized xml file and declare a view.set the setContentView method and use that xml file.如果要自定义警报对话框,请执行以下操作,创建自定义 xml 文件并声明一个视图。设置 setContentView 方法并使用该 xml 文件。 Then inflate the layout using the LAYOUT_INFLATER_SERVICE, thenthere is a method Alertdialog.setview(view)..use that view in it.然后使用 LAYOUT_INFLATER_SERVICE 为布局充气,然后有一个方法 Alertdialog.setview(view)..在其中使用该视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM