Space-Navigation-View icon indicating copy to clipboard operation
Space-Navigation-View copied to clipboard

please take a method to set text below icon.

Open Skqing opened this issue 9 years ago • 8 comments
trafficstars

please take a method to set text below icon.

Skqing avatar Sep 12 '16 05:09 Skqing

this enhancement is more more more recommended and this is all I want from this awesome library. please, Thank you

AbdelQuddous avatar Sep 27 '16 19:09 AbdelQuddous

Please add it to your library.

majidkabir avatar Apr 03 '17 06:04 majidkabir

i think this is basic requirement you should add it

rasik1010 avatar Apr 03 '17 13:04 rasik1010

You can do this by modifying the space_item_view.xml as below

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true">

<LinearLayout
    android:id="@+id/main_content"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/space_icon"
        android:layout_width="@dimen/space_item_icon_default_size"
        android:layout_gravity="center_horizontal"
        android:src="@drawable/near_me"
        android:layout_height="@dimen/space_item_icon_default_size" />

    <TextView
        android:id="@+id/space_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:lines="1"
        android:textSize="@dimen/space_item_text_default_size"
        tools:text="Label One" />
</LinearLayout>

<RelativeLayout
    android:id="@+id/badge_container"
    android:layout_width="16dp"
    android:layout_height="16dp"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="@dimen/badge_left_margin"
    android:layout_marginRight="2dp"
    android:layout_marginTop="3dp"
    android:layout_toRightOf="@+id/main_content"
    android:visibility="gone">

    <TextView
        android:id="@+id/badge_text_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:textColor="@android:color/white"
        android:textSize="10sp"
        android:textStyle="bold" />
</RelativeLayout>

tai-nguyen175 avatar Oct 30 '17 02:10 tai-nguyen175

Seems like there is no solution, I mean I tried a method, setTextAlignment() or sth like that, but whatever value I pass in this method, no change in the icon and text.

pfieffer avatar Feb 20 '18 10:02 pfieffer

i solve this problem with below example.

You can do this by modifying the space_item_view.xml as below

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/white_ripple" android:clickable="true">

<RelativeLayout
    android:id="@+id/main_content"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/space_icon"
        android:layout_width="@dimen/space_item_icon_default_size"
        android:layout_gravity="center"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:layout_height="@dimen/space_item_icon_default_size" />

    <TextView
        android:id="@+id/space_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp"
        android:lines="1"
        android:layout_centerHorizontal="true"
        android:layout_below="@+id/space_icon"
        android:gravity="center"
        android:textSize="@dimen/space_item_text_default_size"
        tools:text="Label One" />
</RelativeLayout>

<RelativeLayout
    android:id="@+id/badge_container"
    android:layout_width="16dp"
    android:layout_height="16dp"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="@dimen/badge_left_margin"
    android:layout_marginRight="2dp"
    android:layout_marginTop="3dp"
    android:layout_toRightOf="@+id/main_content"
    android:visibility="gone">

    <TextView
        android:id="@+id/badge_text_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:textColor="@android:color/white"
        android:textSize="10sp"
        android:textStyle="bold" />
</RelativeLayout>

then you go to SpaceNavigationView.java class and modify this only. public void showIconOnly(boolean value) { isIconOnlyMode = value; } and in your activity/fragment where you want to implement this simply replace this spaceNavigationView.showIconOnly(); to spaceNavigationView.showIconOnly(false);

and voilla! your problem is solved

kashifansari786 avatar Apr 11 '18 08:04 kashifansari786

@kashifansari786 Can we modify SpaceNavigationView.java? And How can we use space_item_view.xml in the space navigation menu? Help me.

pfieffer avatar Apr 12 '18 10:04 pfieffer

Simple way is to import this library as a module an then you have full privilege to modify all this. Thanks

On Thu, Apr 12, 2018, 3:43 PM RaviGarbujaPun [email protected] wrote:

@kashifansari786 https://github.com/kashifansari786 Can we modify SpaceNavigationView.java? And How can we use space_item_view.xml in the space navigation menu? Help me.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/armcha/Space-Navigation-View/issues/15#issuecomment-380751198, or mute the thread https://github.com/notifications/unsubscribe-auth/AZCPDir9S9fQoOLyTPLjDJJ28zD87KHdks5tnyi5gaJpZM4J6PlN .

kashifansari786 avatar Apr 13 '18 09:04 kashifansari786