• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps (Mms) Android id xml issue. Please help.

Fuzzy13

Extreme Android User
Dec 8, 2011
7,284
2,502
A-T-L-A-N-T-A
I'm modding part of a mms app (black bean stock mms) just for personal use and learning code per say. It's one of few that still utilizes the quick reply "pop up" and it's also customizable.

The standard quick reply pop up looks similar to this
hrk54y.jpg


I've changed some things around to make mine look similar to this without the 3 dot menu button.
5a4611.jpg


I've added a small image to the top right corner to act like the "view" button from the original pop up which opens up the current conversation. Even though I've added the android:id associated with the "view button", the button doesn't do anything.

The quick reply pop up is split into 2 xml files. The view and close buttons, text slider and divider for the buttons are in one file and everything else within the pop up "box" is in another. In the xml containing the buttons, I just changed all the values so nothing in that xml would show up because it wasn't needed to achieve the newer design I wanted.


So I'm trying to find out why my new button isn't opening the "view" even though the layout is written correctly and has the correct android:id. Is it because the id is in the other xml from where the new code is written? I know the code is correct because I added an id from the same xml I'm using the new code in like the "send" id and it worked prefect.

Now here's the thing. I added my new code for the new button to the xml that originally contained the "view" button and my new button worked perfect. But I can't get the image to the right location. It's either in a new line above everything or a new line below everything.

I've tried everything I know to and I'm close to giving up. I really need some advice.


If you can't tell my xml knowledge is limited. I've learned by trial and error so please be patient with me. If anyone can offer any help or advice I would be greatly appreciative.
 
Anyone?

There's several things I wanna ask about and learn about but I really don't know where to go. It's hard reading how to's and deciphering other people's questions and answers.

If anyone was willing to take some time out and spend it letting me pick their brain and getting me some answers, I would happily compensate for their time. I have no issues with compensating for knowledge.

If anyone is willing to help me out please let me know. We can then talk time and a dollar amount.
 
Upvote 0
Can you post the code from the relevant xml files?




These are my modded versions but everything that's original is still there. I just changed some values.


Here is the xml that contains the buttons. I assume this xml acts as the "main layout" for the pop up box and the other xml (the actual text, recipient,etc... just "fits" inside this xml.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_gravity="bottom|center" android:orientation="vertical" android:id="@id/QuickMessageMainlayout" android:layout_width="340.0dip" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.v4.view.ViewPager android:gravity="center" android:id="@id/message_pager" android:layout_width="fill_parent" android:layout_height="@dimen/qm_message_height" />

<ImageView android:layout_gravity="bottom|center" android:id="@id/pager_arrow" android:layout_width="0.0dip" android:layout_height="0.0dip" android:src="@drawable/line_divider_arrow" android:scaleType="fitXY" />
<TextView android:textSize="0.0sp" android:textColor="?android:textColorTertiary" android:gravity="center" android:autoLink="all" android:id="@id/message_counter" android:layout_width="0.0dip" android:layout_height="0.0dip" />


<LinearLayout android:orientation="vertical" android:id="@id/buttonPanel" android:layout_width="fill_parent" android:layout_height="wrap_content" android:minHeight="@dimen/qm_dialog_button_bar_height" >
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:measureWithLargestChild="true" style="?android:attr/buttonBarStyle">
<Button android:textSize="0.0sp" android:layout_gravity="left" android:id="@id/button_close" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minHeight="@dimen/qm_dialog_button_bar_height" android:text="@string/button_close" android:maxLines="2" android:layout_weight="1.0" style="?android:attr/buttonBarButtonStyle" />
<Button android:textSize="0.0sp" android:layout_gravity="right" android:id="@id/button_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minHeight="@dimen/qm_dialog_button_bar_height" android:text="@string/button_view" android:maxLines="2" android:layout_weight="1.0" style="?android:attr/buttonBarButtonStyle" />
</LinearLayout>
</LinearLayout>
</LinearLayout>


Here's the contents inside the "frame" (pop up box).

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_gravity="bottom|center" android:orientation="vertical" android:id="@id/QuickMessageContentlayout" android:layout_width="fill_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:layout_gravity="left" android:padding="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content">
<android.widget.QuickContactBadge android:layout_gravity="center" android:id="@id/contactBadge" android:background="@drawable/ic_contact_picture" android:clickable="false" android:layout_width="40.0dip" android:layout_height="40.0dip" android:src="@drawable/ic_contact_picture" android:scaleType="fitCenter" />
<LinearLayout android:layout_gravity="center_vertical" android:orientation="vertical" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="4.0dip">
<TextView android:textAppearance="?android:textAppearanceMedium" android:textColor="#ff33b5e5" android:textColorLink="?android:textColorPrimary" android:ellipsize="end" android:gravity="center_vertical" android:autoLink="phone" android:id="@id/fromTextView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:maxLines="2" />
<TextView android:textSize="12.0sp" android:textColor="#ffcccccc" android:id="@id/timestampTextView" android:layout_width="fill_parent" android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<View android:background="@drawable/divider" android:paddingTop="4.0dip" android:paddingBottom="4.0dip" android:layout_width="fill_parent" android:layout_height="1.0dip" />
<ScrollView android:layout_gravity="center" android:background="#ff282828" android:paddingTop="4.0dip" android:paddingBottom="4.0dip" android:layout_width="fill_parent" android:layout_height="0.0dip" android:minHeight="24.0dip" android:fillViewport="true" android:layout_weight="1.0">
<TextView android:textAppearance="?android:textAppearanceMedium" android:textSize="16.0sp" android:textColor="@color/qm_dark_text" android:textColorLink="?android:textColorPrimary" android:gravity="left" android:autoLink="all" android:id="@id/messageTextView" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:minHeight="24.0dip" />
</ScrollView>
<LinearLayout android:orientation="horizontal" android:id="@id/bottom_panel" android:background="#ff282828" android:paddingLeft="6.0dip" android:paddingTop="0.0dip" android:paddingBottom="0.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageButton android:id="@id/templates_button" android:nextFocusRight="@id/embedded_text_editor" android:layout_width="0.0dip" android:layout_height="0.0dip" android:layout_marginBottom="0.0dip" android:src="@drawable/ic_templates_holo_dark" android:drawablePadding="0.0dip" android:contentDescription="@string/button_templates" style="?android:attr/borderlessButtonStyle" />
<EditText android:textSize="16.0sp" android:textColor="#ffcccccc" android:textColorHint="?android:textColorTertiary" android:layout_gravity="bottom" android:id="@id/embedded_text_editor" android:nextFocusRight="@id/send_button" android:layout_width="0.0dip" android:layout_height="wrap_content" android:minHeight="@dimen/input_text_height" android:hint="@string/type_to_reply_text_enter_to_send" android:maxLines="3" android:maxLength="2000" android:capitalize="sentences" android:autoText="true" android:layout_weight="1.0" android:inputType="textCapSentences|textAutoCorrect|textMultiLine|textShortMessage" android:imeOptions="actionSend|flagNoEnterAction" android:textCursorDrawable="@null" />
<LinearLayout android:layout_gravity="bottom" android:orientation="vertical" android:id="@id/button_with_counter" android:background="#ff282828" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:textAppearance="?android:textAppearanceSmall" android:textColor="@color/qm_dark_text_fade" android:gravity="bottom|center" android:id="@id/text_counter" android:paddingLeft="3.0dip" android:paddingRight="3.0dip" android:paddingBottom="4.0dip" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<ImageButton android:id="@id/send_button_sms" android:nextFocusLeft="@id/embedded_text_editor" android:layout_width="wrap_content" android:layout_height="0.0dip" android:layout_marginLeft="4.0dip" android:layout_marginRight="4.0dip" android:src="@drawable/send_button_selector_dark" android:drawablePadding="0.0dip" android:layout_weight="1.0" android:contentDescription="@string/send" style="?android:attr/borderlessButtonStyle" />
</LinearLayout>
</LinearLayout>
</LinearLayout>



What I'm trying to add.


<Button android:layout_gravity="right" android:id="@id/button_view" android:layout_width="20.0dp" android:layout_height="20.0dp" android:background="@drawable/ic_go" />

Notice that I just want a new button that links to the existing "button view id". If I place this inside the xml where the original id resides, it works fine. But the button will only line up above or below the "contents". It won't line up beside the name like I want it to.

If I add it to the "contents" xml, it wont link to anything when I click it.
 
Upvote 0
You are correct the first xml you posted wraps around the ViewPager which gets populated with the message ,info, sender, send button, etc from the second xml file.

The first file is set to a vertical orientation except for the Close and View buttons. The close and view buttons are inside their own linear layout with a horizontal orientation. Which is why the button you are putting in there is above or below the other objects.

How are you removing the original buttons from that xml? Are you just deleting the linear layout they are inside from the original xml file? Just trying to make sure you don't have @id/button_view used in both files.

I'd also like to see your final xml of the second picture just to see how you tried to add it.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones