What is the name of this menu-like layout item on Android? - java

I see this layout item in a lot of apps but I don't know the name. What is the name of this layout item pictured in the images below?
Image 1
Image 2

You might want to take a look at the PopupMenu class.
Also, this is used for the overflow menu in the Action Bar, you can read more about it here.

They are menus, read official docs.
Contextual Menus are used when you need to show a list of choices, example when you long press in a item in ListView.

Related

How to implement a circular RecylerView / ListView using any CircularLayoutManager

I want to make a CircularListView that will be coming from corner click of screen and only half list item should be visible before scrolling. And the item in list is in Dynamic nature - .
And I have used these libraries from github but not getting any efficient solution from any of them. These libraries are:
RamotionCircleMenu -> In this library custom layout is not possible.
HellocslCursorWheelLayout -> Here no customization is possible, Item Selection is poor.
JungHsuanCircularList -> When you add items in bulk the item overlaps, circle radius not get updated according to item count(still this one is better)
LukedeightonWheelview -> Only Drawable as item is allowed.
So please let me know if anyone is having solution for it. I want the solution for dynamic item count, custom layout as item and smooth scroll of List/RecyclerView.
I'm Using to this layout manager to show recycler view in android
https://github.com/AndroidDeveloper98/CircularRecyclerView

Setting listView.setOnItemClickListener

I have a listView with some items. Every item has a title, picture, and description. Now I'd like to click on particular activity and open new activity, which would be detailed view for particular item. So it needs to have the title and picture from previous activity, and a new, bigger description.
Could someone tell me how to do that?
For passing images to activities see this answer
likewise you can pass the title & description
intent.putExtra("TITLE","title value");
intent.putExtra("DESCRIPTION","Description value")

i want to know what is this window in android?

it's a youtube app and I want to know how to add the configuration window
It is called overflow menu.
See the image and its description below: Google Design Guidelines - Menu.
The action overflow in the app bar will emit a menu.
This particular action overflow menu contains four menu items: Refresh, Help & feedback, Settings, and Sign out.

Highlight and disable Listview items

I have a little Problem with my ListView.
I fill my ListView with an ArrayList<String> per ArrayAdapter<String> with more than 100 items.
Before my dialog will be show i want to highlight and disable some items. I have found the solution with ListView.post(new Runnable() {...});
I highlight my items with lv.getChildAt(2).setBackgroundColor(Color.BLUE);
and disbable an item with lv.getChildAt(3).setEnabled(false);
I do both also in an OnItemClickListener().
Now my problem:
if in the ListView are 11 items visible at runtime, the the highligt- and disable-pattern will repeat every 11 items.
i.e. if i highlight just the 3. item also the 14., 25. ... item will get a blue background.
And if i disable the 4. item also the 15. and 26. and so on is disabled.
If i scroll fast to buttom and back to top other items are highlighted and disabled.
Another problem is, that i can only access the first (11) visible items in the post-runnable. If i try to highlight the 20. item the app will crash with a NullPointerException.
What can i do to prevent the "item-recycling" and to get full access to all items before the Dialog is shown?
I'm not sure i understand what you want to achieve but here are some suggestions for you.
1) Always Recycle, you should never avoid recicling since you maybe run into another problem, you will run out of memory.
2) In your model implement the checkeable interface, so the model should know if an item is selected or not, Not the view only
3) When iterating each element make use of a ViewHolder and then check the model to see if the elment being inflaed it selected or not and use the desired color
Please have a look at this example link, it describes the use of CAB (Contextual Action Bar) but it uses the things i'm mentioning.
I hope it helps you.

Android, show dialog when ListPreference item is clicked

Basically I have a ListPreference to allow a user to change the X position of some text on my Live Wallpaper.
It contains 4 entries: top, middle, bottom and manually input X. The first 3 options are no problem, I simply get the SharedPreferences in my WallpaperService class and check if they are top, middle or bottom and change the position corresponding to their choice.
However, the last option is proving more difficult, what I want to do is have an EditText alert box popup when the user clicks the "Manually input X" ListPreference item so they can enter a value for X. I just cant figure out how to make the alert popup from clicking that specific List element.
You probably want to create a custom ListPreference. Basically you want to extend from ListPreference (see original here), and provide a custom protected void onPrepareDialogBuilder(Builder builder), in which you provide the additional "custom" list item and the onclick to handle the selection of the "custom" entry.
Note that I keep saying "custom" because it would be a best practice to make this class as reusable as possible.
Override onPreferenceTreeClick() in your PreferenceActivity and compare the preference it gives to the one you want to do something for.

Categories