Tuesday 15 May 2012

android - How can I nest a linear layout inside a relative layout to achive the desired UI experience? -


I to this issue have wasted enough time to try to figure out myself, so here post To see if anyone can help me. I'm trying to get the following view on the Android version of my app (screenshot from my iOS app).

screenshot of my iOS app

I own layout file for Android Is defined by:

  & lt ;? Xml version = "1.0" encoding = "utf-8" & gt; & Lt; RelativeLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: id = "@ + id / layout_root" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" & gt; & Lt; Android: layout_alignParentLeft = "true" android: layout_alignParentRight = "right": Android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_above = "@ + id / shareLilayout" android: id = "@ + id / postTextTextView" "Android: layout_alignParentTop =" true "Android: EMS =" 10 "android: gravity =" top | left | beginning "Android: inputType =" textMultiLine "& gt; & Lt; Requestfocus / & gt; & Lt; / EditText> & Lt; LinearLayout android: id = "@ + id / shareLILayout" Android: layout_alignParentBottom = "true" android: background = "# 999999" Android: Layout_width = "Fill_parent" Android: Layout_height = "Wrap_content" android: gravity = "true" Android: Orientation = "horizontal" & gt; & Lt; Android: layout_height = "match_parent" Android: layout_marginRight = "5dp" Android: layout_marginBottom = "5dp" android: content = "@ string / li_btn_desc" android: id = "@ + id / postToLIButton" Android: layout_width = "wrap_content" "Android: Background =" @Android: Color / Transparent "Android: src =" @Drawable / Linking_switch_off "/> & Lt; Android: layout_height = "match_parent" android: text = "@ string / share_on_linkedin" Android: layout_gravity = "center_vertical" Android: textAppearance = "Android": "TextVieworance" Android: id = "@ + id / postToLITextView" android: layout_width = "wrap_content" : ATR / Text Appendixium "Android: Text Size =" 14 SP "/> & Lt; / LinearLayout & gt; & Lt; / RelativeLayout & gt;   

If I swap my image button and textview above, then my app has crashed with runtime uppressure now !! Apart from this, I am unable to focus the text so that it is connected to the center of the button. I should do something wrong and I have tried to search both SEO and Google, I appreciate any indicators in the right direction.

- Good

just ImageButton and TextView Swap orders Your runtime error is either unrelated or you need to rearrange it (sometimes the resource ID is funky), due to the need to clean your project. For this, use android: gravity = "center_vertical" TextView right in the center

No comments:

Post a Comment