TextView not showing in RelativeLayout - android

I have some pop ups in my project which work perfectly, but this one seems to not work, he only shows the buttons, the textviews don't appear (Sorry for bad eng) I tried to use other layouts, but don't looks good at all... what I wanna do is simple use 3 textviews in the middle of screen, if you guys could help me with that i would be glad
popadd.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="match_parent"
android:background="#drawable/dialog_round">
<ImageButton
android:id="#+id/btCancelar"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/cancel"
android:tint="#ffffff"
android:background="#drawable/round_button"
android:padding="5dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="90dp" />
<ImageButton
android:id="#+id/btEnviar"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/certo"
android:tint="#ffffff"
android:background="#drawable/round_button"
android:padding="5dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Adicionar amigo"
android:textSize="70px"
android:textColor="#454545"
android:layout_marginTop="190dp"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enviar solicitação de amizade para"
android:textSize="40px"
android:textColor="#454545"
android:layout_marginTop="240dp"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tvNome"
android:text="Carregando..."
android:textSize="40px"
android:textColor="#454545"
android:layout_marginTop="270dp"
android:layout_centerHorizontal="true"/>
</RelativeLayout>

Try this in your code.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/dialog_round">
<ImageButton
android:id="#+id/btCancelar"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="90dp"
android:background="#drawable/round_button"
android:padding="5dp"
android:src="#drawable/cancel"
android:tint="#ffffff"/>
<ImageButton
android:id="#+id/btEnviar"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="30dp"
android:background="#drawable/round_button"
android:padding="5dp"
android:src="#drawable/certo"
android:tint="#ffffff"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Adicionar amigo"
android:textColor="#454545"
android:textSize="70px"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Enviar solicitação de amizade para"
android:textColor="#454545"
android:textSize="40px"/>
<TextView
android:id="#+id/tvNome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Carregando..."
android:textColor="#454545"
android:textSize="40px"/>
</LinearLayout>
</RelativeLayout>

Related

graph not showing in horizontalscrollview android

i am microcharts.droid.ChartView in xamarin to make a line graph, and i want it to be horizontal scroll able, but by using following code graph is not showing up.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#444444">
<refractored.controls.CircleImageView
app:civ_border_width="2dp"
app:civ_border_color="#FFFFFF"
android:layout_width="80dp"
android:layout_height="80dp"
android:id="#+id/profilepicimageview"
android:src="#drawable/profilepic"
android:scaleType="centerCrop"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp" />
<TextView
android:text="..."
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_below="#id/profilepicimageview"
android:textColor="#android:color/white"
android:id="#+id/txtHomeFullName"
android:layout_marginLeft="5dp" />
<TextView
android:text="12500"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/HomeUserTextViewScore"
android:textColor="#android:color/white"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="30dp"
android:layout_marginRight="60dp" />
<ImageView
android:src="#drawable/star"
android:layout_width="30dp"
android:layout_height="30dp"
android:id="#+id/imageViewStarHome"
android:scaleType="centerCrop"
android:layout_marginTop="30dp"
android:layout_toLeftOf="#id/HomeUserTextViewScore" />
<ProgressBar
style="#android:style/Widget.ProgressBar.Horizontal"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:maxHeight="15dp"
android:minHeight="15dp"
android:layout_below="#id/imageViewStarHome"
android:id="#+id/progressBarHome"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:layout_marginRight="30dp" />
<HorizontalScrollView
android:id="#+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="80dp">
<TextView
android:text="WELCOME TO PERKIT"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:background="#302f2f"
android:textColor="#android:color/white"
android:id="#+id/textViewWelcomeToPerkit" />
<microcharts.droid.ChartView
android:id="#+id/chartView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</HorizontalScrollView>
<LinearLayout
android:id="#+id/linebtn"
android:layout_height="55dp"
android:layout_width="match_parent"
android:background="#444444"
android:layout_alignParentBottom="true"
android:gravity="center"
android:orientation="horizontal">
<ImageButton
android:src="#drawable/rewardDisabled"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginRight="16dp"
android:background="#drawable/roundedbutton"
android:id="#+id/btnHomeReward" />
<ImageButton
android:src="#drawable/leaderDisabled"
android:id="#+id/btnHomeTournaments"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginRight="8dp"
android:background="#drawable/roundedbutton" />
<ImageButton
android:src="#drawable/settingsDisabled"
android:id="#+id/btnHomeSettings"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginLeft="8dp"
android:background="#drawable/roundedbutton" />
<ImageButton
android:src="#drawable/homeEnabled"
android:id="#+id/btnHomeHome"
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginLeft="16dp"
android:background="#drawable/roundedbuttonEnabled" />
</LinearLayout>
<TextView
android:text="Loading.."
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#android:color/white"
android:id="#+id/txtLoadingTextHome"
android:gravity="center"
android:background="#8889" />
</RelativeLayout>
i want to make the graph horizontal scroll able. to show on layout.
thanks. how can i achieve it in android.i am developing the app in xamarin android. is there any other good library to achieve this?
Try to specify a fixed layout_width to the chartView

Table layout xml for leaderboard template - Android

I'm trying to create a layout for a user leader-board but I don't know how to make every "row" equal in proportion.
Here's the list of users:
And this is the code of the child layout (that populates a recyclerview):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/topUsersLeaderboardItem_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="12"
android:orientation="horizontal"
android:paddingBottom="#dimen/margin_extra_small"
android:paddingTop="#dimen/margin_extra_small">
<TextView
android:id="#+id/topUsersLeaderboardItem_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:paddingStart="#dimen/margin_small"
android:textColor="#color/colorBlack"
android:layout_weight="2"
android:layout_gravity="center_vertical"
android:textSize="#dimen/font_size_small"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="8">
<RelativeLayout
android:id="#+id/topUsersLeaderboardItem_layoutPicUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<ImageView
android:id="#+id/topUsersLeaderboardItem_userIcon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:src="#drawable/circular_profile"
app:srcCompat="#drawable/circular_profile" />
<TextView
android:id="#+id/topUsersLeaderboardItem_userInitial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center_vertical|center_horizontal|center"
android:text="U"
android:textSize="#dimen/font_size_medium"/>
</RelativeLayout>
<TextView
android:id="#+id/topUsersLeaderboardItem_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_centerVertical="true"
android:gravity="center_vertical|center_horizontal"
android:text="uername"
android:textColor="#color/colorBlack"
android:layout_marginStart="8dp"
android:layout_toEndOf="#+id/topUsersLeaderboardItem_layoutPicUser"
android:textSize="#dimen/font_size_small"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/topUsersLeaderboardItem_scoreLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"
android:gravity="end">
<TextView
android:id="#+id/topUsersLeaderboardItem_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:text="150"
android:textSize="#dimen/font_size_small"
android:textColor="#color/colorBlack" />
<ImageView
android:id="#+id/topUsersLeaderboardItem_starImage"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="false"
android:layout_centerVertical="true"
android:layout_marginEnd="#dimen/margin_small"
android:layout_toEndOf="#+id/topUsersLeaderboardItem_score"
android:src="#drawable/ic_star_yellow_24dp"
app:srcCompat="#drawable/ic_star_yellow_24dp" />
</RelativeLayout>
As you can see from the picture, the space taken by the numbers on the left increases when I would like it to be fixed. Is there a way to make this sort of "table layout"? Thanks everybody!
Actually, it is because of android:layout_width="wrap_content"
of first TextView, give it some predefined value like android:layout_width="10dp". Don't forget to remove gravity from TextView.
please use this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/topUsersLeaderboardItem_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="12"
android:orientation="horizontal"
android:paddingBottom="#dimen/margin_extra_small"
android:paddingTop="#dimen/margin_extra_small">
<TextView
android:id="#+id/topUsersLeaderboardItem_position"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="0"
android:paddingStart="#dimen/margin_small"
android:textColor="#color/colorBlack"
android:layout_weight="2"
android:layout_gravity="center_vertical"
android:textSize="#dimen/font_size_small"/>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="8">
<RelativeLayout
android:id="#+id/topUsersLeaderboardItem_layoutPicUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<ImageView
android:id="#+id/topUsersLeaderboardItem_userIcon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:src="#drawable/circular_profile"
app:srcCompat="#drawable/circular_profile" />
<TextView
android:id="#+id/topUsersLeaderboardItem_userInitial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center_vertical|center_horizontal|center"
android:text="U"
android:textSize="#dimen/font_size_medium"/>
</RelativeLayout>
<TextView
android:id="#+id/topUsersLeaderboardItem_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_centerVertical="true"
android:gravity="center_vertical|center_horizontal"
android:text="uername"
android:textColor="#color/colorBlack"
android:layout_marginStart="8dp"
android:layout_toEndOf="#+id/topUsersLeaderboardItem_layoutPicUser"
android:textSize="#dimen/font_size_small"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/topUsersLeaderboardItem_scoreLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2">
<TextView
android:id="#+id/topUsersLeaderboardItem_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:text="150"
android:textSize="#dimen/font_size_small"
android:textColor="#color/colorBlack" />
<ImageView
android:id="#+id/topUsersLeaderboardItem_starImage"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="false"
android:layout_centerVertical="true"
android:layout_marginEnd="#dimen/margin_small"
android:layout_toEndOf="#+id/topUsersLeaderboardItem_score"
android:src="#drawable/ic_star_yellow_24dp"
app:srcCompat="#drawable/ic_star_yellow_24dp" />
</RelativeLayout>

How to adjust horizontal views in layout

I am trying to adjust the sizes of my textviews based on the size of the device. However it's partial adjustments. Let me show you what i mean:
The following picture depicts the desired effect. TextView B length determines the length of textview A, that is to say that part C is completely independent and is at the end with fixed size. If the textview A gets it's size reduced,then the end is elipsized. I have tried shifting from using LinearLayout with weights as well as RelativeLayout but haven't achieved the desired effect. Thoughts?
What i have tried:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:foobar="http://schemas.android.com/apk/res-auto"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="50dp"
android:paddingBottom="3dp"
android:paddingTop="3dp">
<com.android.volley.toolbox.NetworkImageView
android:id="#+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ddd"
android:scaleType="centerCrop"
android:visibility="invisible" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.ctrlplusz.anytextview.AnyTextView
android:id="#+id/tv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/input"
android:ellipsize="end"
android:maxLength="20"
android:maxLines="1"
android:paddingLeft="7dp"
android:singleLine="true"
android:text="cshbcadhbhjvbbvjfbvcsdhabcsdjbvjsdbvjsfdbvsfnvk"
android:textColor="#color/black"
android:textSize="20dp"
foobar:typeface="Roboto-Light.ttf" />
<!--android:text="cshbcadhbhjvbbvjfbvcsdhabcsdjbvjsdbvjsfdbvsfnvk"-->
<RelativeLayout
android:id="#+id/input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical">
<com.ctrlplusz.anytextview.AnyTextView
android:id="#+id/price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/toggle"
android:gravity="end"
android:paddingRight="4dp"
android:text="3900"
android:textColor="#color/gray"
android:textSize="20dp"
foobar:typeface="Roboto-Light.ttf" />
<RelativeLayout
android:id="#+id/toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:gravity="end"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/minus"
android:layout_width="38dp"
android:layout_height="35dp"
android:layout_centerVertical="true"
android:background="#drawable/minus_product_icon">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_minus" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/add"
android:layout_width="38dp"
android:layout_height="35dp"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/num"
android:background="#drawable/add_product_icon">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_add_icon" />
</RelativeLayout>
<EditText
android:id="#+id/num"
android:layout_width="40dp"
android:layout_height="35dp"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/minus"
android:background="#drawable/product_custom_edit_text"
android:digits="1234567890"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
android:imeOptions="actionDone"
android:inputType="numberDecimal"
android:padding="2dp"
android:singleLine="true"
android:text="0"
android:textColor="#000"
android:textCursorDrawable="#drawable/mycursor" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<com.ctrlplusz.anytextview.AnyTextView
android:id="#+id/p"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="11dp"
android:textColor="#color/gray"
android:textSize="20dp"
foobar:typeface="Roboto-Light.ttf" />
</RelativeLayout>
Something like this?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="vertical">
<TextView
android:id="#+id/a"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/blue"
android:textColor="#android:color/white"
android:text="hi dear"
android:layout_toLeftOf="#+id/b"/>
<TextView
android:id="#+id/b"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#color/black"
android:textColor="#android:color/white"
android:text="hello world"
android:layout_toLeftOf="#+id/c"/>
<TextView
android:id="#+id/c"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:textColor="#android:color/white"
android:text="hi darling"
android:background="#color/green"/>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="vertical">
<TextView
android:id="#+id/a"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#color/blue"
android:textColor="#android:color/white"
android:text="hi dear"
/>
<TextView
android:id="#+id/b"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#color/black"
android:textColor="#android:color/white"
android:text="hello world"
android:layout_toRightOf="#+id/a"
android:layout_toLeftOf="#+id/c"/>
<TextView
android:id="#+id/c"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:textColor="#android:color/white"
android:text="hi darling"
android:background="#color/green"/>
</RelativeLayout>
As B Is Dependent On A,This Layout Will Work Fine For You. :)

Textview dissapear after changing Visibility of ImageView

Im building a row layout for my ListView and have a problem by it.
Currently my layout looks like this :
XML :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout_ROW"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#null"
>
<ImageView
android:id="#+id/imageView_albumart"
android:layout_alignParentTop="true"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginRight="5dp"
android:background="#color/black"
android:visibility="visible"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="#+id/txt_titel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/txt_artist"
android:layout_alignTop="#+id/imageView_albumart"
android:layout_toRightOf="#+id/imageView_albumart"
android:singleLine="true"
android:text="Titel"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginTop="18dp"
android:textSize="17dp"
android:layout_toLeftOf="#+id/imageView_eq_animation"
android:layout_alignLeft="#+id/txt_artist"
android:layout_alignStart="#+id/txt_artist" />
<TextView
android:id="#+id/txt_artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView_albumart"
android:layout_marginBottom="16dp"
android:layout_toRightOf="#+id/imageView_albumart"
android:text="Artist"
android:singleLine="true"
android:textSize="13dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_toLeftOf="#+id/imageView_eq_animation" />
<ImageView
android:id="#+id/imageView_eq_animation"
android:layout_width="30dp"
android:layout_height="70dp"
android:src="#drawable/ic_equalizer1_white_36dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:visibility="gone"
android:layout_alignParentLeft="#+id/txt_artist"
android:layout_alignBottom="#+id/imageView_albumart" />
<TextView
android:id="#+id/txt_length"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0:00"
android:singleLine="true"
android:textSize="10dp"
android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_below="#+id/txt_titel"
android:layout_alignParentRight="true" />
</RelativeLayout>
Now when I want to change the visibility of the imageView_albumart to android:visibility="gone" I get this result :
Can you see where my format problem is ? I just want to hide the imgAlbumart so Title and Artist TextViews stand alone.
Set the visibility of the View to View.INVISIBLE instead of View.GONE
Try Like this, You Can Design the UI With Combination of RelativeLayout and LinearLayout. Do search in Google about design pattern and Usage Of Layouts in Android. You Will get ideas.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#null"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView_albumart"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:background="#android:color/darker_gray"
android:visibility="visible" />
<RelativeLayout
android:id="#+id/RelativeLayout_ROW"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:background="#null">
<TextView
android:id="#+id/txt_titel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="20dp"
android:singleLine="true"
android:text="Titel"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="17dp" />
<TextView
android:id="#+id/txt_artist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_titel"
android:layout_marginBottom="16dp"
android:singleLine="true"
android:text="Artist"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="13dp" />
<ImageView
android:id="#+id/imageView_eq_animation"
android:layout_width="30dp"
android:layout_height="70dp"
android:layout_alignBottom="#+id/txt_artist"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:src="#drawable/ic_game"
android:visibility="gone" />
<TextView
android:id="#+id/txt_length"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/imageView_eq_animation"
android:singleLine="true"
android:text="0:00"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="10dp"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
Yes there is problem in your layout
change your layout to this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout_ROW"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:id="#+id/imageView_albumart"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginRight="5dp"
android:background="#000"
android:visibility="gone"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="#+id/txt_titel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView_albumart"
android:text="Titel"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginTop="18dp"
android:textSize="17sp"
android:layout_toLeftOf="#+id/imageView_eq_animation"
/>
<TextView
android:id="#+id/txt_artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView_albumart"
android:layout_marginBottom="16dp"
android:layout_toRightOf="#+id/imageView_albumart"
android:text="Artist"
android:singleLine="true"
android:layout_below="#+id/txt_titel"
android:textSize="13dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_toLeftOf="#+id/imageView_eq_animation" />
<ImageView
android:id="#+id/imageView_eq_animation"
android:layout_width="30dp"
android:layout_height="70dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:visibility="visible"
android:layout_alignParentLeft="#+id/txt_artist"
android:layout_alignBottom="#+id/imageView_albumart" />
<TextView
android:id="#+id/txt_length"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0:00"
android:singleLine="true"
android:textSize="10dp"
android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_below="#+id/txt_titel"
android:layout_alignParentRight="true" />
it will do..

Ripple effect isn't fire properly onClick

I'm trying to use this lib https://github.com/traex/RippleEffect. I tried the sample and everything works fines but when I try to use this with more views inside the RippleView like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ripple="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:id="#+id/drive_layoutT"
android:layout_height="72dp"
android:weightSum="1"
android:background="#fff"
android:orientation="horizontal">
<com.andexert.library.RippleView
android:id="#+id/rippleView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ripple:rv_color="#797979">
<LinearLayout
android:layout_width="fill_parent"
android:id="#+id/drive_layout"
android:layout_height="72dp"
android:weightSum="1"
android:background="#fff"
android:orientation="horizontal">
<ImageView
android:id="#+id/drive_icon"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:padding="4dp" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="71dp"
android:layout_marginLeft="14dp">
<ImageView
android:id="#+id/drive_menu_btn"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:clickable="true"
android:paddingRight="10dp"
android:src="#drawable/button_overflow_menu"
android:layout_marginRight="2dp" />
<View
android:layout_width="22dp"
android:layout_height="22dp"
android:id="#+id/drive_badge"
android:padding="8dp"
android:background="#drawable/circle"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/drive_menu_btn"
android:layout_toStartOf="#+id/drive_menu_btn" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/drive_name"
android:textColor="#color/grey_list_item_title"
android:textSize="16sp"
android:ellipsize="end"
android:singleLine="true"
android:layout_alignTop="#+id/drive_menu_btn"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="#+id/drive_spinner"
android:layout_toStartOf="#+id/drive_spinner" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/drive_details"
android:textColor="#color/grey_list_item_details"
android:textSize="10sp"
android:ellipsize="end"
android:singleLine="true"
android:layout_below="#+id/drive_name"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="#+id/drive_badge"
android:layout_toStartOf="#+id/drive_badge" />
<ProgressBar
style="#style/CustomProgressBar"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:id="#+id/drive_progress_bar"
android:layout_below="#+id/drive_details"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="3dp"
android:layout_marginRight="16dp"
android:indeterminate="false" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="9"
android:id="#+id/drive_badge_text"
android:layout_marginRight="6.5dp"
android:layout_marginEnd="6dp"
android:layout_centerVertical="true"
android:layout_alignRight="#+id/drive_badge"
android:layout_alignEnd="#+id/drive_badge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="+"
android:id="#+id/drive_badge_plus"
android:textSize="7sp"
android:layout_marginRight="3dp"
android:layout_marginEnd="2dp"
android:layout_centerVertical="true"
android:layout_alignRight="#+id/drive_badge"
android:layout_alignEnd="#+id/drive_badge" />
<ProgressBar
style="?android:attr/progressBarStyleSmall"
android:layout_width="30dp"
android:layout_height="30dp"
android:id="#+id/drive_spinner"
android:layout_alignBottom="#+id/drive_details"
android:layout_toLeftOf="#+id/drive_badge"
android:layout_toStartOf="#+id/drive_badge"
android:indeterminate="false"
android:layout_marginBottom="3dp" />
</RelativeLayout>
<View
android:id="#+id/drive_divider"
android:layout_width="match_parent"
android:layout_height="0.8dp"
android:background="#color/grey_divider"
android:layout_marginTop="0dp"
android:layout_marginLeft="8dp" />
</LinearLayout>
</LinearLayout>
</com.andexert.library.RippleView>
</LinearLayout>
The ripple effect doesn't fire onClick, if I make a long press click I can see that the ripple effect happens. So this leads to a conclusion which is that this delay is caused because the RippleView is loading all the views inside.
How can I fixe this? Or is there anything I'm getting wrong or any work around for this issue?

Categories

Resources