Search Results

Search found 911 results on 37 pages for 'textview'.

Page 6/37 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • How to ellipsize center-aligned textview beside a right-aligned button when screen width is small

    - by simplymoody
    ------------------------------------ | LONG_TITL... |button| | |------------------------------------| | | I have an app header which consists of the app title and a button. The button should be fixed on the right side but I want the title to be in the middle and ellipsize when the screen is too small. Problem is the title just won't ellipsize even though the button is nearly beside it. Here's what I have so far: <RelativeLayout android:id="@+id/headr" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center"> <ImageView android:id="@+id/bar_orange" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:minHeight="40dp" android:scaleType="centerCrop" android:src="@drawable/bar_orange"/> <TextView android:id="@+id/Title" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:gravity="center" android:text="@string/bcd" android:textColor="#FFFFFF" android:ellipsize="marquee" android:singleLine="true" android:textSize="18sp" android:textStyle="bold"/> <Button android:padding="5dp" android:id="@+id/home" android:textColor="#ffffff" android:layout_marginRight="10dp" android:layout_marginLeft="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:singleLine="true" android:background="@drawable/button_home" android:text="@string/home"/> </RelativeLayout> Is there a way to do this with just RelativeLayout?

    Read the article

  • Passing Activity A's data into Activity B

    - by user1058153
    What i am trying to show here is that I am trying to pass the data in Activity A to Activity B. Activity A mainly there are 3 textbox for me to key in something then a button to go to Activity B(Confirmation Page) and in Activity B, i am able to show what i have keyed in Activity A. I am new to Android, so can someone guide me through this? In Activity A @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activitya); Textview01 = (EditText) this.findViewById(R.id.txtView1); Textview02 = (EditText) this.findViewById(R.id.txtView2); Textview03 = (EditText) this.findViewById(R.id.txtView3); mButton = (Button) findViewById(R.id.button); mButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(ActivityA.this, ActivityB.class); i.putExtra("Textview01", txtView1.getText().toString()); i.putExtra("Textview02", txtView2.getText().toString()); i.putExtra("Textview03", txtView3.getText().toString()); startActivity(i); In Activity B. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.confirmbooking); TextView txtPickup = (TextView) this.findViewById(R.id.txtPickup); TextView txtLocation = (TextView) this.findViewById(R.id.txtLocation); TextView txtDestination = (TextView) this.findViewById(R.id.txtDestination); txtLocation.setText(getIntent().getStringExtra("Location")); txtPickup.setText(getIntent().getStringExtra("Pick Up Point")); txtDestination.setText(getIntent().getStringExtra("Destination")); In my Activity B XML <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="txtView01:" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtView01"></TextView> <TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="txtView02:"></TextView> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtView02"></TextView> <TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="txtView03:"></TextView> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtView03"></TextView> <Button android:id="@+id/btnButton" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="Book now" /> </LinearLayout> Can someone tell me if this is correct? I'm getting some error like a popup Instrumental.class. LogCat shows : 11-26 17:27:40.895: INFO/ActivityManager(52): Starting activity: Intent { cmp=ActivityA/.ActivityB (has extras) } 11-26 17:27:42.956: DEBUG/dalvikvm(252): GC_EXPLICIT freed 156 objects / 11384 bytes in 346ms 11-26 17:27:47.815: DEBUG/dalvikvm(288): GC_EXPLICIT freed 31 objects / 1496 bytes in 161ms

    Read the article

  • Add newlines to a text resource in Android?

    - by shmuelp
    I have a custom Dialog that contains only a TextView to display some text in my application. The documentation lists that only the b, i, u, tt, big, small, sup, sub, and strike tags are supported. I really need to add some newlines for readability. Do I need to change to a more complicated layout, or is there some way to encode newlines in the resource? I tried adding br tags, but that did not help.

    Read the article

  • Vertical (rotated) label in Android

    - by DroidIn.net
    I need 2 ways of showing vertical label in Android: Horizontal label turned 90 degrees counterclockwise (letters on the side) Horizontal label with letters one under the other (like a store sign) Do I need to develop custom widgets for both cases (one case), can I make TextView to render that way, and what would be a good way to do something like that if I need to go completely custom?

    Read the article

  • Simple Android Binary Text Clock

    - by Hristo
    Hello, I want to create a simple android binary clock but my application crashes. I use 6 textview fields: 3 for the decimal and 3 for the binary representation of the current time (HH:mm:ss). Here's the code: import java.text.SimpleDateFormat; import java.util.Calendar; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class Binary extends Activity implements Runnable { Thread runner; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); if (runner == null) { //start the song runner = new Thread(this); runner.start(); } } @Override public void run() { TextView hours_dec = (TextView) findViewById(R.id.hours_dec); TextView mins_dec = (TextView) findViewById(R.id.mins_dec); TextView secs_dec = (TextView) findViewById(R.id.secs_dec); TextView hours_bin = (TextView) findViewById(R.id.hours_bin); TextView mins_bin = (TextView) findViewById(R.id.mins_bin); TextView secs_bin = (TextView) findViewById(R.id.secs_bin); SimpleDateFormat hours_sdf = new SimpleDateFormat("HH"); SimpleDateFormat mins_sdf = new SimpleDateFormat("mm"); SimpleDateFormat secs_sdf = new SimpleDateFormat("ss"); Calendar cal = Calendar.getInstance(); while (runner != null) { WaitAMoment(); cal.getTime(); hours_dec.setText(hours_sdf.format(cal.getTime())); mins_dec.setText(mins_sdf.format(cal.getTime())); secs_dec.setText(secs_sdf.format(cal.getTime())); hours_bin.setText(String.valueOf(Integer.toBinaryString(Integer.parseInt((String) hours_dec.getText())))); mins_bin.setText(String.valueOf(Integer.toBinaryString(Integer.parseInt((String) mins_dec.getText())))); secs_bin.setText(String.valueOf(Integer.toBinaryString(Integer.parseInt((String) secs_dec.getText())))); } } protected void WaitAMoment() { try { Thread.sleep(100); } catch (InterruptedException e) { }; } }`

    Read the article

  • Connecting Android XML and Code

    - by Nick
    I'm new to android and have gotten used to doing all my previous UI in code. I can understand the simple examples, but I'm trying something more complex and have no idea how to do it in code and XML. I'm trying to use the google map api and draw text on the map at a specified spot. I have succeeded in doing so by extending overlay and overriding the draw method using drawtext. This has pretty much accomplished what I'm looking to do, but I want have read that is poor practice. I now want to add a second line below the first and just using \n does not work. I can work it out using another drawtext method, but I figured it would be better to create a custom textview, I just have no idea how to position it using code and encapsulate it inside the overlay. Maybe the way I'm doing it is the best way...

    Read the article

  • Custom iPad keyboard backspace method last character crash

    - by isaaclimdc
    I'm making a custom UI iPad keyboard app, and I'm doing something similar to this post for the backspace method: custom backspace button crashes iPhone app However, the app will always crash when I "backspace" for the last character in the UITextView. I know -substringToIndex won't work for an empty string, but I tried using a temporary mutable string then using -deleteCharactersInRange, and that crashed it too. I'm guessing the crash is due to me manually setting the -selectedRange property for the text view after deleting a character? But even if I do: textView.selectedRange = NSMakeRange(0, 0); the app will crash. Any ideas?

    Read the article

  • Android font out of view on small screen

    - by user581949
    Hi Everyone I have several text views that take up the majority of the screen in landscape view in a relativelayout and the font size i have set is quite big (150dp). The text views are all timers and the furthest to the right is the "seconds" textview. My problem is that when testing on a phone with a small screen res the seconds are way outside the limit of the screen and can't be seen. They are in perfect place on normal to large screen resolutions just not on a small screen. Is there any way i can force the "seconds" text view to stay on screen, without adjusting the font size or margins between each text view? Even if it means looking cramped on a small screen i can live with that. Any help is greatly appreciated. Thanks This is the corresponding code:

    Read the article

  • Android: Why my user Interface does not get drawn when I Inflate the resource layout file?

    - by Einiosaurus
    First of all, I'm a newbie on Android programming, so please be detailed in your answers. I have a layout main.xml file with format similar to <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:orientation = "vertical" android:layout_width = "fill_parent" android:layout_height = "fill_parent"> <LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:orientation = "horizontal"   android:layout_width = "fill_parent" android:layout_height = "fill_parent"> <EditText android:id="@+id/a" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/xSquared" android:layout_width = "fill_parent" android:layout_height = "wrap_content" android:text = "@string/equationPart1" /> </LinearLayout> <LinearLayout ... </LinearLayout> </LinearLayout> In my Java source file, I inflate the UI using command: setContentView(R.layout.main); public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } However, when I run the emulator, the UI does not show up like what I expect. Instead, it just display a simple EditText text box. I wonder what is going wrong. Is it because I put a layout inside another layout? I don't think there is any problem with that right?

    Read the article

  • setwidth of a dynamic textview

    - by sairam333
    For Example , I am using name.setWidth(100) for giving width to dynamic text view name .But this width is adjusted only android but in droid this space is not adjusted how we give the setwidth value that will adjust to both droid and android

    Read the article

  • UITextView insert text in the textview text

    - by John Smith
    I want to have to occasionally insert text into the UITextView text object. For example, if the user presses the "New Paragraph" button I would like to insert a double newline instead of just the standard single newline. How can I go about such? Do i have to read the string from UITextView, mutate it, and write it back? Then how would I know where the pointer was? Thanks

    Read the article

  • Select TextView with trackball

    - by janfsd
    I have different elements in my layout: Buttons, RadioButtons, EditText, and I have made a RelativeLayout that is clickable and starts a new intent. Everything works ok except that I can't select that element with the trackball. Is there any way to achieve this? Thanks in advance.

    Read the article

  • why custom state won't work with compound drawable?

    - by schwiz
    Hello I am trying to make a password registration widget that will show a little checkbox in the textbox when both password boxes match. I decided to go about this by extending EditText to implement a valid and an empty state and then just use a state-list drawable to handle everything else. I followed the same method that the CompoundButton uses to add a custom state and everything seems to be right but the image will never change no matter what the state is (custom state or even state_focused etc) Is there some reason that the compound drawables of a TextView wouldn't work as a state-list drawable? Or, am I doing something wrong? Here is attrs.xml <resources> <declare-styleable name="ValidyState"> <attr name="state_valid" format="boolean"/> <attr name="state_has_text" format="boolean"/> </declare-styleable> </resources> my selector <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/com.schwiz.test"> <item android:drawable="@drawable/emptyspace" app:state_has_text="false"/> <item android:drawable="@drawable/ic_valid" app:state_valid="true" app:state_has_text="true"/> <item android:drawable="@drawable/ic_invalid" app:state_valid="false" app:state_has_text="true"/> </selector> and in my overridden EditText class private static final int[] VALID_STATE_SET = { R.attr.state_valid }; private static final int[] HASTEXT_STATE_SET = { R.attr.state_has_text }; ... private void refreshDrawables(){ Drawable[] drawables = getCompoundDrawables(); for(int i = 0; i < drawables.length; i++){ if(drawables[i] != null) { drawables[i].setState(getDrawableState()); } } invalidate(); } @Override protected void drawableStateChanged() { super.drawableStateChanged(); refreshDrawables(); } @Override protected int[] onCreateDrawableState(int extraSpace) { final int[] drawableState = super.onCreateDrawableState(extraSpace + 2); if(hasText){ mergeDrawableStates(drawableState, HASTEXT_STATE_SET); } if(isValid){ mergeDrawableStates(drawableState, VALID_STATE_SET); } return drawableState; }

    Read the article

  • Clicking Elements in Android Doesn't Display the Correct Values

    - by Devin
    I apologize if this code looks a bit like a mess (considering the length); I figured I'd just include everything that goes on in my program at the moment. I'm attempting to create a fairly simple Tic Tac Toe app for Android. I've set up my UI nicely so far so that there are a "grid" of TextViews. As a sort of "debug" right now, I have it so that when one clicks on a TextView, it should display the value of buttonId in a message box. Right now, it displays the correct assigned value for the first element I click, but no matter what I click afterwards, it always just displays the first value buttonID had. I attempted to debug it but couldn't exactly find a point where it would pull the old value (to the best of my knowledge, it reassigned the value). There's a good possibility I'm missing something small, because this is my first Android project (of any note). Can someone help get different values of buttonId to appear or point out the error in my logic? The code: package com.TicTacToe.app; import com.TicTacToe.app.R; //Other import statements public class TicTacToe extends Activity { public String player = "X"; public int ALERT_ID; public int buttonId; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //Sets up instances of UI elements final TextView playerText = (TextView)findViewById(R.id.CurrentPlayerDisp); final Button button = (Button) findViewById(R.id.SetPlayer); final TextView location1 = (TextView)findViewById(R.id.location1); final TextView location2 = (TextView)findViewById(R.id.location2); final TextView location3 = (TextView)findViewById(R.id.location3); final TextView location4 = (TextView)findViewById(R.id.location4); final TextView location5 = (TextView)findViewById(R.id.location5); final TextView location6 = (TextView)findViewById(R.id.location6); final TextView location7 = (TextView)findViewById(R.id.location7); final TextView location8 = (TextView)findViewById(R.id.location8); final TextView location9 = (TextView)findViewById(R.id.location9); playerText.setText(player); //Handlers for events button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click if (player.equals("X")){ player = "O"; playerText.setText(player); } else if(player.equals("O")){ player = "X"; playerText.setText(player); } //Sets up the dialog buttonId = 0; ALERT_ID = 0; onCreateDialog(ALERT_ID); showDialog(ALERT_ID); } }); location1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Sets up the dialog buttonId = 1; ALERT_ID = 0; onCreateDialog(ALERT_ID); showDialog(ALERT_ID); } }); location2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Sets up the dialog buttonId = 2; ALERT_ID = 0; onCreateDialog(ALERT_ID); showDialog(ALERT_ID); } }); location3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Sets up the dialog buttonId = 3; ALERT_ID = 0; onCreateDialog(ALERT_ID); showDialog(ALERT_ID); } }); location4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Sets up the dialog buttonId = 4; ALERT_ID = 0; onCreateDialog(ALERT_ID); showDialog(ALERT_ID); } }); location5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Sets up the dialog buttonId = 5; ALERT_ID = 0; onCreateDialog(ALERT_ID); showDialog(ALERT_ID); } }); location6.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Sets up the dialog buttonId = 6; ALERT_ID = 0; onCreateDialog(ALERT_ID); showDialog(ALERT_ID); } }); location7.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Sets up the dialog buttonId = 7; ALERT_ID = 0; onCreateDialog(ALERT_ID); showDialog(ALERT_ID); } }); location8.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Sets up the dialog buttonId = 8; ALERT_ID = 0; onCreateDialog(ALERT_ID); showDialog(ALERT_ID); } }); location9.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Sets up the dialog buttonId = 9; ALERT_ID = 0; onCreateDialog(ALERT_ID); showDialog(ALERT_ID); } }); } protected Dialog onCreateDialog(int id){ String msgString = "You are on spot " + buttonId; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(msgString) .setCancelable(false) .setNeutralButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); return alert; } }

    Read the article

  • In an Android TextView, is it possible to insert paragraphs?

    - by johnrock
    Below is an example of the type of problem that I have. I have data in a pojo that I need to display in a textview... the data has pseudo code that denotes each paragraph with [p] I would like to somehow parse the [p]'s into paragraphs when they are displayed in the textview. Can this be done? Is there something I can substitute for the [p] that will make a new paragraph in the textview? Question question = new Question(); question.setText("Here is the first paragraph.[p] And this should be the second."); TextView view = (TextView) findViewById(R.id.qtext); view.setText(question.getParsedText());

    Read the article

  • Highlighting Text Color using Html.fromHtml() in Android?

    - by sunil
    Hi, I am developing an application in which there will be a search screen where user can search for specific keywords and that keyword should be highlighted. I have found Html.fromHtml method. But I will like to know whether its the proper way of doing it or not. Please let me know your views on this. Regards Sunil

    Read the article

  • android scroll down

    - by Faisal khan
    I have text area and and down to that "ok" and "cancel" button. when i click on text area keyboard appear and focus on the text area and buttons get hide behind the keyboard. i want when text area get focus scroll a little bit and also display the bottom buttons while text area id selected.

    Read the article

  • Android (Milestone/Droid): View.OnKeyListener not working correctly?

    - by Ice09
    I am using a simple EditText and register an View.OnKeyListener. Some GUI changes should happen (fading in/out of views) when certain conditions for the EditView text apply. In the emulator, this works as expected. On the Motorola Droid/Milestone, the listener does not work, only after pressing DEL, the listener is called the first time and always afterwards when activating the number input, the listener works correctly Note: I deactivated the suggestions with TYPE_TEXT_FLAG_NO_SUGGESTIONS and used the IME action IME_ACTION_GO to have a workaround for this (otherwise the user could not "start" a request).

    Read the article

  • Android: How to make current layout with scrollable text view?

    - by Solata
    I tried multiple solution but none seem to work. Layout: -------------------- |btn1| txt1 |btn2| -------------------- | | | | | | | txtview1 | | | | | | | -------------------- btn1 - top left aligned - decrease txt1 btn2 - top right aligned - increase txt1 txt1 - top center aligned - text/number entered with code textview1 - client aligned with vertical scrollbar, if needed - text entered with code

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >