shehabic / Droppy

A simple yet-powerful and fully customizable Android drop-down menu. It supports Text with/without Icons, Separators, and even fully customized views.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to change Text in Custom View??

HowardSchmaeu opened this issue · comments

i try to use your Custom View Excample:

// Add custom views DroppyMenuCustomView sBarItem = new DroppyMenuCustomView(R.layout.slider); droppyBuilder.addMenuItem(sBarItem);

and my Slider looks like this:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    xmlns:tools="http://schemas.android.com/tools"
    >


    <ImageView
        android:id="@+id/picDrawable"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:scaleType="centerCrop"
        android:src="@drawable/pic"
        android:layout_marginRight="10dp"
         />

    <TextView
        android:id="@+id/name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/picDrawable"
        android:maxLines="1"
        android:layout_marginBottom="2dp"
        android:text="test"
        />

how can i set the text of "android:id="@+id/name"" dynamically ?? I've tried with sBarItem.getView().findViewById(R.id.name)
but sBarItem.getView() is always null...

yourActivity.findViewById(R.id.name)

this is only working if the Menu is showing (the User clicked)...
what I wanna do is something like this:

droppyBuilder.addMenuItem(new DroppyMenuCustomItem(R.layout.dropdown_item)); droppyBuilder.addMenuItem(new DroppyMenuCustomItem(R.layout.dropdown_item)); droppyBuilder.addMenuItem(new DroppyMenuCustomItem(R.layout.dropdown_item));

where "R.layout.dropdown_item" is the Layout i've shown above AND i wanna set the Text of the "R.id.name" for each item dynamically
How can i do that??

True, hiding is actually destroying the view completely not just hiding, just like the behavior of native Android context menu