Text not fiting in Button - android

i am trying to display the text in the center of button, but text is not completely fit in the button like that
here is i am trying to display V and W and space is also there but it just not fit in. Help Please
text of style is like this
<style name="textstyle">
<item name="android:textSize">15sp</item>
<item name="android:gravity">center</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#000000</item>
</style>
size of button is decided on run time
box = new Button(context);
box.setTextAppearance(context, R.style.input_box_textstyle);
Drawable image = context.getResources().getDrawable(R.drawable.inputbox);
box.setBackgroundDrawable(image);
.
.
.
if(size <= n)
{
Log.v("textsize..", width+"");
p = new LinearLayout.LayoutParams(width, height);
}
else
{
p = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 60);
p.weight = 1;
}
box.setLayoutParams(p);
isSet = false;

Issue solve by setting the
box.setIncludeFontPadding(false);
box.setPadding(0, 0, 0, 0);

I hope this must be your xml
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:layout_below="#id/imagetitle"
android:orientation="horizontal">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="V" android:id="#+id/previous" />
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="W" android:id="#+id/next" />
</LinearLayout>

Related

How to display soft keyboard after AlertDialog show

I have Google this proplem, but none of the answers works for me.
This is the style of my AlertDialog
<style name="dialog_full_screen">
    <item name="android:windowBackground">#android:color/transparent</item>
    <item name="android:windowFrame">#null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowContentOverlay">#null</item>
    <item name="android:windowAnimationStyle">#android:style/Animation.Dialog</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:backgroundDimEnabled">true</item>
</style>
This is the code to show it.
val alertDialog = AlertDialog.Builder(this, R.style.dialog_full_screen).apply {
setCancelable(true)
}.create()
alertDialog.apply {
val wlp = window!!.attributes
wlp.gravity = Gravity.BOTTOM
wlp.flags = wlp.flags and WindowManager.LayoutParams.FLAG_DIM_BEHIND.inv()
val displayMetrics = DisplayMetrics()
windowManager.defaultDisplay.getMetrics(displayMetrics)
wlp.width = displayMetrics.widthPixels
wlp.height = WindowManager.LayoutParams.WRAP_CONTENT
window!!.attributes = wlp
}
alertDialog.show()
The following code is layout
<LinearLayout
android:id="#+id/linear_layout_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
style="#style/CenterInConstraintLayout"
tools:ignore="MissingConstraints">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/index_play_page_icon_comments_null"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/homepage_no_comments"
android:textColor="#color/color_gray_dark2"
android:textSize="#dimen/font_size_14"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
android:gravity="center">
<EditText
android:id="#+id/edit_text_comment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:maxLength="150"
android:hint="#string/homepage_hint_comment"
android:textColorHint="#color/color_gray_dark2"
android:background="#null"
android:importantForAutofill="no" />
<ImageView
android:id="#+id/image_view_send"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginEnd="30dp"
/>
</LinearLayout>
This AlertDialog can show properly, but i can't show soft keyboard
alertDialog.window.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
Give the EditText the type of softkeyboard you want, otherwise default will get applied
// Get the Edit text box to put into the dialog
final EditText input = findViewById(R.id.edit_text_comment)
// set the type of input entered, this would be for entry of a number digit keyboard
input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_NORMAL);
...
input.requestFocus();
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
alertDialog.show();
There is also question posted for similar situation here:
when using AlertDialog.Builder with EditText, the Soft Keyboard doesn't pop
or else try this:
How to show soft-keyboard when edittext is focused

customize Google Plus Sign in Button And Facebook Login Button

I need to customize Google Plus Sign in Button And Facebook Login Button like image below
As far as i know, Facebook Login Button make width and height by text size and padding
to change Google Sign in button i used the below method :
private void setGooglePlusButton(SignInButton signInButton, String buttonText) {
// ExceptionHelpers.dLog("GOOGLE_PLUS_TAG", "Child Count : "+signInButton.getChildCount());
signInButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
for (int i = 0; i < signInButton.getChildCount(); i++) {
View v = signInButton.getChildAt(i);
// ExceptionHelpers.dLog("GOOGLE_PLUS_TAG", "Type Of Child : "+v.getClass().getName());
if (v instanceof TextView) {
TextView tv = (TextView) v;
tv.setText(buttonText);
tv.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
tv.setBackgroundResource(R.drawable.google_background_drawable);
tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.facebook_compound_drawable, 0, 0, 0);
int padding = (int) getResources().getDimension(R.dimen.header_padding);
int drawablePadding = (int) getResources().getDimension(R.dimen.header_padding);
tv.setPadding(padding, padding, padding, padding);
tv.setCompoundDrawablePadding(drawablePadding);
tv.setTextColor(getResources().getColor(R.color.white_color));
tv.setTextSize(getResources().getDimension(R.dimen.font_title));
return;
}
}
}
and Facebook Login Button Style :
<style name="FacebookLoginButton">
<item name="android:layout_marginTop">#dimen/adapter_mark_padding</item>
<item name="android:layout_marginBottom">#dimen/adapter_mark_padding</item>
<item name="android:padding">#dimen/header_padding</item> <!-- #dimen/adapter_mark_padding -->
<item name="android:textSize">#dimen/font_title</item>
<item name="android:textColor">#color/white_color</item>
<item name="android:background">#drawable/facebook_background_drawable</item>
<item name="android:drawableLeft">#drawable/facebook_compound_drawable</item>
<item name="android:drawablePadding">#dimen/header_padding</item>
</style>
Output is :
<ImageView
android:id="#+id/fb_new_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:src="#mipmap/ic_launcher" />
<RelativeLayout
android:id="#+id/fb_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone">
<com.facebook.login.widget.LoginButton
android:id="#+id/login_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
Put the code of login Facebook code in the click listener of the ImageView
it will work
for Facebook you need to use style:
<style name="FacebookLoginButton">
<item name="android:textSize">15dp</item>
<item name="android:textAllCaps">false</item>
<item name="android:layout_gravity">center</item>
<item name="android:textColor">#color/colorWhite</item>
<item name="android:paddingLeft">13dp</item>
<item name="colorButtonNormal">#color/colorAccent</item>
<item name="android:paddingTop">11dp</item>
<item name="android:paddingBottom">11dp</item>
<item name="android:layout_marginLeft">4dp</item>
<item name="android:layout_marginRight">5dp</item>
</style>
Apply the style like this
<com.facebook.login.widget.LoginButton
xmlns:facebook="http://schemas.android.com/apk/res-auto"
android:id="#+id/login_button"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
style="#style/FacebookLoginButton"
facebook:com_facebook_login_text="#string/login_facebook"
facebook:com_facebook_logout_text="#string/login_facebook"
android:elevation="2dp"
/>
as for google you can use a normal button with your wanted style
<Button
android:id="#+id/button_googlePlus"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/login_google"
android:background="?attr/selectableItemBackground"
android:textColor="#color/colorWhite"
android:textAllCaps="false"
android:textSize="15dp"
android:drawableLeft="#drawable/ic_google"
android:paddingLeft="40dp"
android:paddingRight="40dp"
/>

style spinner drop down list

I have several issues with styling a spinner
I need to change the drawable of the spinner(selected view)
when the user opens the dropdown list(I tried several selectors
with different states but nothing works properly)
I can`t change the text color on the items in dropdown list (I can change
color but I need different color for the selected value) you can see in more
detail in links below.
I can`t remove the dividers from the dropdown.
I don`t want to use custom layout with button and a list to simulate the functionality of spinner(but if there is no solution I will do that).
The style.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppBaseTheme" parent="#android:style/Theme.Black.NoTitleBar.Fullscreen">
<item name="android:background">#android:color/transparent</item>
<item name="android:windowBackground">#android:color/white</item>
<item name="android:colorBackground">#android:color/white</item>
<item name="android:dropDownSpinnerStyle">#style/SpinnerTheme</item>
</style>
<style name="SpinnerAppTheme" parent="android:Widget.Holo.Light.Spinner">
<item name="android:background">#drawable/spinner_background_holo_light</item>
<item name="android:dropDownSelector">#drawable/list_selector_holo_light</item>
<item name="android:dropDownListViewStyle">#style/mySpinnerStyle</item>
</style>
<style name="mySpinnerStyle" parent="android:Widget.ListView.DropDown">
<item name="android:divider">#null</item>
<item name="android:dividerHeight">0px</item>
</style>
<style name="Theme_Dialog_Translucent" parent="android:Theme.Dialog">
<item name="android:windowBackground">#null</item>
<item name="android:background">#android:color/white</item>
<item name="android:windowTitleStyle">#style/dialog_title_style</item>
</style>
<style name="Theme_Dialog_Measurment_Data_Dialog" parent="android:Theme.Dialog">
<item name="android:windowBackground">#null</item>
<item name="android:background">#color/general_background_color</item>
<item name="android:windowTitleStyle">#style/dialog_title_style</item>
</style>
<style name="dialog_title_style" parent="android:Widget.TextView">
<item name="android:textColor">#android:color/black</item>
</style>
<Spinner
android:id="#+id/res_spinner"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="60"
android:background="#drawable/ref_spinner_selector"
android:dropDownVerticalOffset="1dp"
android:dropDownWidth="60dp"
android:gravity="center"
android:popupBackground="#null"
android:spinnerMode="dropdown"/>
how the spinner needs to be look like
how the spinner looks like now
Thanks
Update:
if anyone will have problems to customize spinners
I manage to fix all the issues using ListPopupWindow
private void initPopup()
{
_lp = new ListPopupWindow(getActivity());
_lp.setAnchorView(_resTitle);
ColorDrawable cd = new ColorDrawable(getResources().getColor(android.R.color.transparent));
_lp.setBackgroundDrawable(cd);
_lp.setOnDismissListener(new OnDismissListener()
{
#Override
public void onDismiss()
{
_resTitle.setSelected(false);
}
});
_listPopupAdapter = new DataSetListAdapter(getActivity(), _resData);
_lp.setAdapter(_listPopupAdapter);
}
onclick
case R.id.res_title:
if (!_lp.isShowing())
{
_resTitle.setSelected(true);
_lp.setOnItemClickListener(this);
_lp.show();
_lp.getListView().setDivider(null);
_lp.getListView().setDividerHeight(0);
}
else
{
_resTitle.setSelected(false);
_lp.dismiss();
}
break;
Android does not permit make customization of spinner UI.So
If you want to modify your spinner UI,Then use android popup view where you can put your style UI with effect like drop-down menu
example
spinner=(EditText)findViewById(R.id.txt_Spinner);
spinner.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
p = new Point();
p.x = location[0]+(v.getHeight());
p.y = location[1]+v.getHeight();
if (p != null)
showPopup(statusActivity.this, p);
System.out.println("show popup");
}
});
// The method that displays the popup.
private void showPopup(final Activity context, Point p) {
int popupWidth = 300;
int popupHeight = 500;
// Inflate the popup_layout.xml
LinearLayout viewGroup = (LinearLayout) context.findViewById(R.id.popup);
LayoutInflater layoutInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = layoutInflater.inflate(R.layout.popup_layout, viewGroup);
// Creating the PopupWindow
popup = new PopupWindow(context);
popup.setContentView(layout);
popup.setWidth(popupWidth);
popup.setHeight(popupHeight);
popup.setFocusable(true);
// Some offset to align the popup a bit to the right, and a bit down, relative to button's position.
int OFFSET_X = 00;
int OFFSET_Y = 00;
// Clear the default translucent background
popup.setBackgroundDrawable(new BitmapDrawable());
// Displaying the popup at the specified location, + offsets.
popup.showAtLocation(layout, Gravity.NO_GRAVITY, p.x + OFFSET_X, p.y + OFFSET_Y);
((TextView)layout.findViewById(R.id.textView2)).setClickable(true);
((TextView)layout.findViewById(R.id.textView3)).setClickable(true);
((TextView)layout.findViewById(R.id.textView4)).setClickable(true);
((TextView)layout.findViewById(R.id.textView5)).setClickable(true);
((TextView)layout.findViewById(R.id.textView6)).setClickable(true);
((TextView)layout.findViewById(R.id.textView7)).setClickable(true);
((TextView)layout.findViewById(R.id.textView8)).setClickable(true);
((TextView)layout.findViewById(R.id.textView9)).setClickable(true);
}
and popup.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/popup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/popup_bg"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
style="#style/text_orange_heading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select Status"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView2"
style="#style/text_blue_contains"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:onClick="onClick"
android:clickable="true"
android:drawableBottom="#drawable/line_white"
android:tag="Sleeping"
android:text="Sleeping" />
<TextView
android:id="#+id/textView3"
style="#style/text_blue_contains"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:onClick="onClick"
android:clickable="true"
android:drawableBottom="#drawable/line_white"
android:tag="Available"
android:text="Available" />
<TextView
android:id="#+id/textView4"
style="#style/text_blue_contains"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:onClick="onClick"
android:clickable="true"
android:drawableBottom="#drawable/line_white"
android:tag="Busy"
android:text="Busy" />
<TextView
android:id="#+id/textView5"
style="#style/text_blue_contains"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:onClick="onClick"
android:clickable="true"
android:drawableBottom="#drawable/line_white"
android:tag="At work"
android:text="At work" />
<TextView
android:id="#+id/textView6"
style="#style/text_blue_contains"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:onClick="onClick"
android:clickable="true"
android:drawableBottom="#drawable/line_white"
android:tag="Battery charge low"
android:text="Battery charge low" />
<TextView
android:id="#+id/textView7"
style="#style/text_blue_contains"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:onClick="onClick"
android:clickable="true"
android:drawableBottom="#drawable/line_white"
android:tag="In meeting"
android:text="In meeting" />
<TextView
android:id="#+id/textView8"
style="#style/text_blue_contains"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:onClick="onClick"
android:clickable="true"
android:drawableBottom="#drawable/line_white"
android:tag="TMS me later"
android:text="TMS me later" />
<TextView
android:id="#+id/textView9"
style="#style/text_blue_contains"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:onClick="onClick"
android:clickable="true"
android:drawableBottom="#drawable/line_white"
android:tag="At the toilet"
android:text="At the toilet" />
<EditText
android:id="#+id/textCustomize"
style="#style/text_blue_contains"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:tag="Customize"
android:text="Customize" />

Android: Define programmatically RelativeLayout inside ViewFlipper

Based on this article, I've tried to build a ViewFlipper with multiple RelativeLayouts.
When proceeding as written in article (only change the height), I got (as expected) a ViewFlipper normally displayed :
My xml :
<ViewFlipper
android:id="#+id/view_flipper"
android:layout_width="fill_parent"
android:layout_height="200dp" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="#drawable/img1" />
<TextView
style="#style/ImageTitle"
android:text="Test test" />
</RelativeLayout>
</ViewFlipper>
Style:
<style name="ImageTitle">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">50dp</item>
<item name="android:layout_alignParentBottom">true</item>
<item name="android:background">#99000000</item>
<item name="android:gravity">center</item>
<item name="android:maxLines">2</item>
<item name="android:textColor">#fff</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">18sp</item>
<item name="android:typeface">sans</item>
</style>
Then I've tried do generate RelativeLayout programmatically with the code below :
public void generateViewForFlipper(String url, int id, String text){
//new RelativeLayout
RelativeLayout relativeLayout = new RelativeLayout(this);
//Params for the RelaviteLayout
final ViewFlipper.LayoutParams frameLayoutLayoutParams = new ViewFlipper.LayoutParams(
ViewFlipper.LayoutParams.MATCH_PARENT,ViewFlipper.LayoutParams.MATCH_PARENT);
//ImageView
ImageView imageView = new ImageView (this);
imageView.setImageDrawable(getResources().getDrawable(R.drawable.img1));
imageView.setScaleType(ScaleType.CENTER_INSIDE);
imageView.setAdjustViewBounds(true);
// Params for the ImageView
final RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.MATCH_PARENT );
//Application title
TextView textView = (TextView)getLayoutInflater().inflate(R.layout.tvtemplate, null);
textView.setText(text);
// Params for application title
final RelativeLayout.LayoutParams textParams = new RelativeLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, 50);
mViewFlipper.addView(relativeLayout, frameLayoutLayoutParams);
relativeLayout.addView(imageView,imageParams);
relativeLayout.addView(textView,textParams);
}
tvtemplate.xml:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
style="#style/ImageTitle" />
Result screen :
As you can see, text is not aligned to the bottom, not "match_parent", and picture is not cropped..
Thank you

RelativeLayout.ALIGN_PARENT_RIGHT not work

RelativeLayout.ALIGN_PARENT_RIGHT not work. (((
it is my Android-Function.
She added new message to a stage.
I do not understand.
Why my code does not work correctly
private void addMessageToStage(Message message) {
LinearLayout scrollChatMessagesOutput = (LinearLayout) findViewById(R.id.chatMessagesOutput);
LayoutInflater layoutInflater = getLayoutInflater();
View view = layoutInflater.inflate(R.layout.chat_single_message, null, false);
TextView messageTextView = (TextView) view.findViewById(R.id.singleChatMessageTextView);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
if (messagesAlignId % 2 == 0) {
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
messageTextView.setBackgroundResource(R.drawable.chat_input_message_shape);
} else {
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
messageTextView.setBackgroundResource(R.drawable.chat_output_message_shape);
}
messageTextView.setText(Html.fromHtml("<b><u>" + message.getMessage() + "<font color=\"#cccccc\" size=\"4px\">" + "\n" + message.getTime() + "</font></b></u>"));
RelativeLayout messageAlignLayout = new RelativeLayout(this);
messageAlignLayout.addView(view, params);
scrollChatMessagesOutput.addView(messageAlignLayout);
}
It is chat_single_message.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/chatMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1.0" >
<TextView
android:id="#+id/singleChatMessageTextView"
style="#style/singleChatMessageTextStyle" />
</LinearLayout>
It is singleChatMessageTextStyle.
<style name="singleChatMessageTextStyle" parent="#android:style/TextAppearance.Small">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginBottom">10dp</item>
<item name="android:layout_marginLeft">5dp</item>
<item name="android:layout_marginRight">5dp</item>
<item name="android:padding">3dp</item>
<item name="android:layout_weight">0.7</item>
<item name="android:textColor">#000000</item>
<item name="android:typeface">sans</item>
<item name="android:textSize">12sp</item>
</style>
Consider using two different layouts:
A layout with the text on the left, chat_single_message_left.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/chatMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1.0" >
<TextView
android:id="#+id/singleChatMessageTextView"
style="#style/singleChatMessageTextStyle" />
<View
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:visibility="invisible" />
</LinearLayout>
A similar layout with the text on the right, chat_single_message_right.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/chatMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1.0" >
<View
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:visibility="invisible" />
<TextView
android:id="#+id/singleChatMessageTextView"
style="#style/singleChatMessageTextStyle" />
</LinearLayout>
And you should use a ListView to display each message rather than a ScrollView, ListView's are much faster for big conversations.

Categories

Resources