I used the Settings Activity template to create a new activity in android studio. After creating it, I cannot find the layout file of the activity anywhere. Where can I find the layout file? If there is no layout file for Settings Activity template, how can I change its contents?
Android studio also created a new folder called xml, does this have anything to with the settings activity?
Settings Activities typically use preferences defined in an XML file. These aren't exactly layouts, so they are usually placed in the xml resource subdirectory. Read more about preference-based settings screens on this page.
By default the Settings activity extends PreferenceActivity which has a standard layout. The layout is shown in the documentation
Nonetheless, if you want to change it, you can refer to this question
Related
I am learning android framework. I see these three get added when I add a new Blah.java basic activity. I would like to know what is the purpose of each one of it?
activity.xml
This xml file is design view of your activity. Its for designing purpose and also thats front end of screen view.you can design xml by using android layout and widgets.
fragment.xml
This xml file is design view of your fragments.
content.xml
Thats also part of activity.xml design file .we can access/use it from others xml file by using include
<include layout="#layout/content"/>
This are the layout xml for your android app, activity refers to your class, if you are using any fragment in your app then you should have one fragment.xml.
content is something which is optional, you can create anything inside content and then you can include that in both fragment and activity xml.
I am presuming you are using an IDE (Android Studio), which has this great advantage of generating layout files while creating Activities in android.
Now layout files (.xml) files are used for generating views, while creating an activity you are given a option (in IDE) whether you want to create a fragment for the activity.
For each of them the activities and fragments there will be a layout file and based on your activity/fragment name the layout files name will be generated (which can be edited)
In your case:
activity_blah.xml and content_blah.xml are the layout files generated for the blah.java activity file, you can add view components in the layout files for user interface of the activity
fragment_blah.xml is generated for fragment.
Since the latest changes, the main activity has an activity_main.xml and a content_main.xml.
I'm creating a new activity now in the same project but no matter how I create it, I can't get Android Studio to create both xml files for the new activity. This means that I can't remove the toolbar unless I do so programmatically. That's fine by me.
Ultimately, I'm just wondering if I should create both xml files for the second activity.... like:
activity_notmain.xml
content_notmain.xml
or should I just create the one layout file and remove the toolbar programmatically?
just right click on res>layout and go to new>activity>blank activity then enter name for activity and layout file it will automatically create both activity and content xml file
in eclipse ADT plugin when i create a preference activity it provides two modes design view and the xml file of the preference activity. The design view had the tab name "structure" that provides the easy adding of values to attributes through certain input boxes. But in android studio i can create an android XML file to create an activity but i cannot find the designer view of the activity, the "structure" tab?
its no longer available and in android you have to do it manually i.e.write elements and attributes set values. Do it in the same XML file.
Ok i created a new project in Eclipse for Android. My MainActivity is what was given to me. It has an activity_main.xml in the res.layout folder that i can drag and drop widgets onto the activity.
I created a new Activity called SurveyActivity but I can not find the xml file that allows me to use the palette.
Did i do something wrong when creating the activity or is there more that i need to do to get this to work?
Thanks
I Assume you created a class(and not an Activity, which can be done with ADT 20) and extended Activity. Then you have to create a layout xml by your own. Right click on te layout folder -> new -> Android xml file. Set this layout in your setContentView() of your Activity.
And don't forget to register that Activity in your Manifest.
my Android xml fle Design look like this.
but i want to view like this so how can do this?
Right click on xml and select open with -> Android XML Resources Editor and also
you can try open with -> Android Layout Editor to have Design Layout tab.
I also faced this problem earlier for all xml files but not for manifest file ,now it resolved
in my application our requirement is When the orientation of the activity changes place the appropriate land folder and xml files.in that we give wrong naming conventions for the layout folders instead of layout-land,layout-land-hdpi,layout-land-mdpi,layout-land-ldpi,layout-port,layout-port-hdpi,layout-port-mdpi,layout-port-ldpi when ever we correct the naming conventions it comes normally.