I've got an preference screen with android:dialogLayout="#layout/my_own_layout"
I would like to make my own dialogLayout look almost exactly like the default one, only with some minor changes (adjusting the spaces between title and summary).
Is there any way I can get the default layout? With the text sizes, paddings and so on?
Any help is appreciated.
You can always check the default layouts in different platforms and you can modify them.
For instance you can access the alert dialog layout in the following path:
android-sdk\platforms\android-15\data\res\layout\
for Android API LvL 15.
You can search for other api levels anytime to check different layouts there.
Related
I'm using the Settings library on my app and since I'm going to creat a very similar screen on my app, I'd like to know what are the sizes of the title and summary textviews to maintain a similar look.
You can simply use Android Studio layout inspector and check the TextViews font sizes.
You can access the layout inspector by searching for it with "double shift" shortcut.
When you inpect the layout, you will see that the Title is 16sp and the Summary is 14,2sp
I am tasked with creating this kind of pop-up message for an app. I attached an image bellow with the design,
Note that the pop-up is placed right bellow a certain ImageButton to indicate something about it. The pop-up must also contain an ImageView, a TextView and two Buttons.
I know that the Alert Dialog native for Android opens a Dialog Popup at the center of the screen that has a rectangular shape and also makes the background behind it darker. But I want to create something that matches this design exactly and right now I have no idea how.
Can anyone show me how to do this, if necessary, even a library would help. All that matters is that the solution has to work on any Android OS equal or higher than v6.0 (Marshmallow).
Thank You!
Below popup library will help
https://android-arsenal.com/details/1/2927
you can inflate your custom View into this library
I checked android docs, but didn't really find an answer on how to show custom layout in my application. I'm thinking of custom fragment placed next to navigation drawer. Maybe someone can give me pseudo code for better understanding? Thanks.
Visual representation:
http://imgur.com/a/VwTvs
On specific itemClick I want to make a layout (that contains icons/pictures) and place it next to nav drawer.
The key-word you are searching for is resource buckets. Essentially you can create resource-folders based on screen size, API version, orientation and such. Refer to the official documentation on how to create layouts for different screen sizes.
In Android Studio you can create resource-files based on those quantifiers by open the "new resource file" dialog and selecting the quantifiers you want in the lower part of the dialog.
Have a look here to read on layouts made exclusively for TVs.
I've got a handful of configuration dialogs in my app, and they all have Cancel/OK buttons at the bottom. Now, in API level 11 and up, I want to show Cancel on the left and OK on the right, and also use the ButtonBar style. In API levels 10 and lower I want to show floating buttons, with OK on the left.
Presently I have copies of the XML layouts in both my layout and my layout-v11 folder, with nothing different between them but the button area. However these layouts are fairly complex and I'm trying to save some space, so it would really be better to just have one copy of each layout, and just snap the layouts into a template with the correct button style on the bottom. What would be the best way to go about this? Fragments?
Why not do just the button swap programatically? You can find the build version codes from SDK_INT and swap the PositiveButton and NegativeButton based on the SDK versions.
If you have the layouts in the xml files and cannot be done in the code for some reasons, you have just the buttons in two different layouts and use the merge tag
I want to create a popup screen with multiple views, just like home screen but as a popup. As I am relatively new to android, so I am not aware if any such control is built in or do I need to use any library? or any hint would be helpful.
EDIT: I am looking for an alternation to viewpager, which is supported minimum on API8.
It sounds like a PopupWindow may be what you're looking for. Added, in API 1, this let's you add a View(s) dynamically or you can set the layout to an already created xml file.
A popup window that can be used to display an arbitrary view. The popup window is a floating container that appears on top of the current activity.
You also can create an Activity with whatever Layout you need in xml and give it a Dialog theme to make it look like a pop up by setting the
android:theme="#android:style/Theme.Dialog"
in the <activity> tag of the manifest
I found the answer from the comment #codeMagic's comment below his answer, so posting here for the reference:
for ViewPager alternative we can use ViewFlow or ViewPagerIndicator library, there minimum supported SDK are API level 1 & 4 respectively.