android-view

Canvas is not Showing Image/Drawable

て烟熏妆下的殇ゞ 提交于 2019-12-13 12:46:37
问题 I am doing a work on SVG Paths and Image. I have loaded SVG file and get an image and try to set thi image on canvas . But canvas is not showing image. I check the height and width and null check of this image/picture and it is not null so i am unable to understand that why canvas is not showing image. any help My code: public class MainActivity extends Activity{ Context c; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); c=getApplicationContext()

How do i do setOnClickListener in Fragment

夙愿已清 提交于 2019-12-13 10:12:24
问题 Please i'm noob in android,i just have been assigned a task and i need to finish it in two days, I need to set Onclicklistener(this),i received a code from someone,and i had to make changes to it,i'm trying to implement this in Fragment View sortableHeaderWrappers[]=new View[]{view.findViewById(R.id.date_wrapper),view.findViewById(R.id.status_wrapper)}; And then there's something written as for(int i=0;i<sortableHeaderWrappers.length;i++) { sortableHeaderWrappers[i].setTag((Integer)i);

How to set visibility of TextView? [closed]

我怕爱的太早我们不能终老 提交于 2019-12-13 09:09:09
问题 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 3 years ago . I want to check! For example - if (tv.Visible == true) then showMessage ("Yee it's Visible") else ("Its not visible"); I hope you're understand! 回答1: You provide very little information, but I think this is what you are after... TextView tv = (TextView)findViewById(R.id.textView); tv.setVisibility

How to click on specific list view item child view

霸气de小男生 提交于 2019-12-13 08:07:59
问题 I am trying to click on a specific child view in a list view item. Consider ListView with items. Each item is a compound view with child views. I want firstly select specific list item and than use this item view find child with a specific id and perform a click. Here is my code for getting list item, but I have tried to continue this chain further to achieve desired goal, but I can't find proper methods. onData(anything()).inAdapterView(withId(R.id.list_view_books)).atPosition(0).?? Could

android onTouchEvent work

試著忘記壹切 提交于 2019-12-13 04:48:08
问题 I have created my own custom view class by extending "SurfaceView." I then override the onTouchEvent method. Two questions. (1) Should I even both calling the super.onTouchEvent even though I handle everything (I think) I need? (2) Should have the work done in a new thread? I am receiving many Skipped 32 frames! The application may be doing too much work on its main thread Is the onTouchEvent called from the UI thread? My view is nothing more than a joy stick and on the on touch event I

onTouchEvent in a BaseAdapter Android

有些话、适合烂在心里 提交于 2019-12-13 04:37:47
问题 In my program I must insert this onTouchEvent method in a BaseAdapter component: public class FlipAdapter extends BaseAdapter { ... public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: { startY = event.getY(); break; } case MotionEvent.ACTION_UP: { float endY = event.getY(); if (endY > startY) { layoutComments.startAnimation(animDown); layoutComments.setVisibility(View.GONE); } } } return true; } This function works in an Activity (it's

Android ListView-like scrolling WITHOUT the ListView

守給你的承諾、 提交于 2019-12-13 03:22:52
问题 I've been Googling like crazy for a while now, and I simply can't find any answers to the question: is it possible to implement the Android List scrolling, without using an actual list UI? I'm trying to make a grid of rectangles such as the kind you would find in a typical game app respond to finger movement in the same way that it does using Android lists (bounce on the bounds, the 'flick' effect, etc), but all of the approaches I've found involve over-complicated solutions involving

How to handle UI changes from interaction with a view when using a RecyclerView?

我是研究僧i 提交于 2019-12-13 02:55:48
问题 If we have a RecyclerView that will have views of different type we can inflate the view we need based on an item type e.g. @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int type) { View view = null; switch (type) { case TYPEX: view = LayoutInflater .from(viewGroup.getContext()) .inflate(R.layout.typex, viewGroup, false); return new ViewHolderX(view); case TYPEY: view = LayoutInflater .from(viewGroup.getContext()) .inflate(R.layout.typey, viewGroup, false); return new

How to decrease TextView text size in Android 4.0?

北战南征 提交于 2019-12-13 02:28:27
问题 (EDIT: problem fixed. See answer below) I am stuck with this issue and it blocks a release so every help will be greatly appreciated. Below is a trivial program that demonstrates the issue. I built it with the latest SDK (R19). It works well on gingerbread but fails on ICS. When the text size is increased (10 -> 30 -> 50) the text field height grows as expected but when the text size is reduced (50 -> 10), the text field has the full height, as if the text size is 50. Anybody can reproduce it

Dynamic position of views in RecyclerView

情到浓时终转凉″ 提交于 2019-12-12 23:54:00
问题 My question is based on a previous question about my Code - it's a newsfeed with different views which are scrollable vertically or horizontally or display various content (ads basically) VERTICAL VIEW HORIZONTAL VIEW AD VIEW Now I managed with the help of Ben P, on my previous post to organize my views with the following code: this.items = new ArrayList<>(); if (listVertical.size() > 0) { items.add(listVertical.remove(0)); } if (listHorizontal.size() > 0) { items.add(listHorizontal.remove(0)