textview

android - how to have a clickable AND checkable textview

不想你离开。 提交于 2021-02-16 18:58:26
问题 I want to have the following: a textview that .)changes its background when clicked .)maintains that background until it is clicked again it all comes down to the "checkable" state, but i couldnt figure out how this exactly works. here is the xml i am using for background: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- pressed --> <item android:drawable="@drawable/menuselected" android:state_pressed="true" /> <!-- checked -->

Set visibility of TextView in android not working

点点圈 提交于 2021-02-10 14:21:06
问题 My program runs into a runtime exception when I try to make the view 'GONE'. My code that handles it: setContentView(R.layout.list_main); ... lv = getListView(); View header = (View) findViewById(R.id.header_layout_root); TextView tv = (TextView) header.findViewById(R.id.new_highscore); tv.setVisibility(View.GONE); lv = getListView(); LayoutInflater inflater = getLayoutInflater(); View header = inflater.inflate(R.layout.list_header, (ViewGroup) findViewById(R.id.header_layout_root)); lv

text isn't showing after using setText() to TextView() in inflated layout

流过昼夜 提交于 2021-02-10 13:59:29
问题 Yes, I know that similar questions were asked before but I tried many of those. So I have a problem with setting text in TextView in the inflated layout. I tried setContentView() then it works but then activity_main.xml with the menu isn't working. So I tried to inflate layout with TextView that I need. When I try to setText() it just doesn't displaying it. Here is my code: public void bodAlg() { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

Android: Lock components in place with soft keyboard

*爱你&永不变心* 提交于 2021-02-09 14:01:28
问题 The soft keyboard moves a TextView object up with it, (adjusting), and this causes the TextView to overlay another TextView that I'd like to be able to see. I need a way to lock this TextView specifically , so that the keyboard will overlay it. But only that component. I do not want to pan the entire window, just this one, single, TextView object. Is there a way to tell the TextView, "Dammit bro, don't move with the keyboard" programmatically? To be honest, I'd also be willing to settle for

Android: Lock components in place with soft keyboard

余生长醉 提交于 2021-02-09 14:01:16
问题 The soft keyboard moves a TextView object up with it, (adjusting), and this causes the TextView to overlay another TextView that I'd like to be able to see. I need a way to lock this TextView specifically , so that the keyboard will overlay it. But only that component. I do not want to pan the entire window, just this one, single, TextView object. Is there a way to tell the TextView, "Dammit bro, don't move with the keyboard" programmatically? To be honest, I'd also be willing to settle for

Android: Lock components in place with soft keyboard

吃可爱长大的小学妹 提交于 2021-02-09 13:59:48
问题 The soft keyboard moves a TextView object up with it, (adjusting), and this causes the TextView to overlay another TextView that I'd like to be able to see. I need a way to lock this TextView specifically , so that the keyboard will overlay it. But only that component. I do not want to pan the entire window, just this one, single, TextView object. Is there a way to tell the TextView, "Dammit bro, don't move with the keyboard" programmatically? To be honest, I'd also be willing to settle for

Android: Lock components in place with soft keyboard

吃可爱长大的小学妹 提交于 2021-02-09 13:59:20
问题 The soft keyboard moves a TextView object up with it, (adjusting), and this causes the TextView to overlay another TextView that I'd like to be able to see. I need a way to lock this TextView specifically , so that the keyboard will overlay it. But only that component. I do not want to pan the entire window, just this one, single, TextView object. Is there a way to tell the TextView, "Dammit bro, don't move with the keyboard" programmatically? To be honest, I'd also be willing to settle for

Touch listener on multiple Textviews?

孤者浪人 提交于 2021-02-08 09:58:56
问题 private TextView tv2; tv2=(TextView)findViewById(R.id.textView2); tv2.setOnTouchListener(new CustomTouchListener()); public class CustomTouchListener implements View.OnTouchListener { public boolean onTouch(View view, MotionEvent motionEvent) { switch(motionEvent.getAction()){ case MotionEvent.ACTION_DOWN: Hauteur.setTextSize(TypedValue.COMPLEX_UNIT_PX, 80); Hauteur.startAnimation(AnimationUtils.loadAnimation(recuperationJson.this, android.R.anim.slide_in_left)); break; case MotionEvent

Touch listener on multiple Textviews?

本小妞迷上赌 提交于 2021-02-08 09:58:10
问题 private TextView tv2; tv2=(TextView)findViewById(R.id.textView2); tv2.setOnTouchListener(new CustomTouchListener()); public class CustomTouchListener implements View.OnTouchListener { public boolean onTouch(View view, MotionEvent motionEvent) { switch(motionEvent.getAction()){ case MotionEvent.ACTION_DOWN: Hauteur.setTextSize(TypedValue.COMPLEX_UNIT_PX, 80); Hauteur.startAnimation(AnimationUtils.loadAnimation(recuperationJson.this, android.R.anim.slide_in_left)); break; case MotionEvent

How to change data of Main Activity from Fragment [closed]

瘦欲@ 提交于 2021-02-08 08:00:40
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . Improve this question I Have fragment 1, fragment 2, fragment 3 which are in the Main Activity. there is a TextView in the main Activity, how can the fragments change the text in the text view? I already did the casting (Actvity).getActivity but i don't want my app to have error when changing