I want my activity to take smaller area of the screen e.g. toast doesn't cover all of the screen, it is just shown over other things and rest of the contents can be seen behind the toast. But it's a dialog, and I want my screen to be shown above other things e.g. above Home Screen. Below is the idea that is in my mind.
Kindly, guide me if it is even possible. If possible then show me the right path.
Thanks.
make your activity theme as translucent.
add the following line in your manifest against that activity:
android:theme="#android:style/Theme.Translucent"
so that you can see the background things add the view to a LinearLayout with android:alignParentBottom=true.
Latest versions force a style based on Theme.AppCompat. Use this to create a quick dialog style based activity.
android:theme="#style/Theme.AppCompat.Dialog"
you can use custom dialog box.
Check this and also this
you can design you layout transparent so view main activity also.
Related
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 have an update for my app that includes ActionBarSherlock with a sliding menu. I have put my navigation entirely in to the sliding menu, leaving my main_activity pretty bare. I am worried the user won't know about the menu. So I want to add a prompt at start-up that will highlight the new feature. Like this:
I am not even sure what this is called, so I don't know how to research it. Any help or suggestions will be rewarded. Thanks!
You could just use overlay layout (Frame layout with multiple inner layouts will fit perfectly. Please note Frame Layout Z axis is by the lower the layout is in the xml, so the guide should be the last in the XML). Make that layout's background mostly transparent and add buttons and design to fit your needs. When you don't want to show the layout just set visibility to gone. And when you need it set to visible.
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.
I have a ListView which should have the "Theme" theme in portrait and the "Theme.Light" theme in landscape mode. How do I do that? The theme seems to be tied to the activity, and for the ListView I can only change the style, but I dont find a style which works.
Or, is there a way to change the activity's theme based on orientation? By code or prefereable by xml?
To be more precise and explain the reason: I try to start experimenting with the fragment compatibility library. The starting activity shows in portrait mode a list which looks best with black background. When I touch a list item, a second Activity starts and shows a ListView which better looks on white, so this second Activity has the Theme.Light. Works so far.
When I switch to landscape, I try to show both ListViews aside. The second one on the right has to have a white background. The first one on the left could stay on white also (so the whole activity could change the theme), but I'd like to see one on black and one on white, if possible. (I put both ListViews in Fragments, this is done and works. Only the colors are wrong.)
Any ideas?
Greetings, Joerg
You would create a layout.xml file for each orientation, and put each in the proper folder according to the Android standards.
Then, you can set the different style as an attribute in each XML file.
Android will use the appropriate layout file automatically, depending on orientation.
I want to use the user's current homescreen as an element of an app, including their icons and layout. I do not expect it to be dynamic, just a static image of their screen upon which the app can act. The "Cracked Screen" app does this like I'm thinking.
In researching, I've found ways to grab a screenshot (requires root) or grab the current wallpaper (doesn't include icons), but nothing yet about this particular issue.
Any ideas? Thanks!
Use the translucent theme. Set it in your AndroidManifest for the relevant activity like this:
<activity android:theme="#android:style/Theme.Translucent"
...>
This sets the users homescreen with it's icons as the background of the activity, your views float over that. Alternatively you can use #android:style/Theme.Translucent.NoTitleBar if you want to hide the title bar additionally.