android-gridview

Adjust GridView with ImageViews to different screen sizes, Android

旧街凉风 提交于 2019-12-25 16:47:47
问题 I'd so appreciate if someone could advise on below. My GridView has 3 columns that will be filled with ImageViews: <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/grid_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:layout_marginRight="10dp" android:layout_marginLeft="10dp" android:numColumns="3" android:columnWidth="0.3dp" android:horizontalSpacing="20dp"

How to handle multiple listeners inside GridView in Android

点点圈 提交于 2019-12-25 10:19:10
问题 In my app, a GridView has list of contents. Each item is inflated with a layout. Single item inside the gridview contains, an image and 2 textviews . I have a requirement that when I click on the image, the image should be replaced with another image and when I click on any other places it should open a popup. I am able to listen to the second event, using OnItemClickListener . It opens the popup. How can I handle the first case? I mean how can I listen to OnClick event of image? 回答1: In your

Text color by programmatically created grid view content

强颜欢笑 提交于 2019-12-25 07:06:13
问题 I understand how to do this in design view, but I'm not sure how to create a style based on programmatically created elements. I followed a tutorial and here's where I'm at: I have a grid view which is populated by a string array as in the code below: ... gridView = (GridView) findViewById(R.id.gridView); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, strData); gridView.setAdapter(adapter); Each element of the string array populates the grid

GridView, Get Item's parent View

て烟熏妆下的殇ゞ 提交于 2019-12-25 03:15:14
问题 I'm trying to send clicks to my child elements in GridView with a single touch event. So far, I can retrieve the data of the child element, but cannot perform a click on it. Let me explain a bit more on the layout of things... GridView - Touch Event Handler here... LinearLayout - onClick listeners here... TextView - Just some text... An adapter fills GridView with LinearLayout 's who have onClick events defined. These layouts contain TextView s where TextView.setText("Some data from my

I am not able to set multiple image in grid view?

这一生的挚爱 提交于 2019-12-25 03:08:29
问题 I am creating app in which 1.take photo from camera. 2.save its URI in database 3.using cursor and adaptor i retrieve image uri and sets in grid view. i am getting error as " error opening trace file: No such file or directory (2)" also i cant see any folder formed with name "my image" Main activity public class MainActivity extends ActionBarActivity { private static final int CAMERA_CAPTURE_IMAGE_REQUEST_CODE = 100; final int MEDIA_TYPE_IMAGE=2; Button click; ImageView image; Uri fileuri;

I am not able to set multiple image in grid view?

青春壹個敷衍的年華 提交于 2019-12-25 03:07:14
问题 I am creating app in which 1.take photo from camera. 2.save its URI in database 3.using cursor and adaptor i retrieve image uri and sets in grid view. i am getting error as " error opening trace file: No such file or directory (2)" also i cant see any folder formed with name "my image" Main activity public class MainActivity extends ActionBarActivity { private static final int CAMERA_CAPTURE_IMAGE_REQUEST_CODE = 100; final int MEDIA_TYPE_IMAGE=2; Button click; ImageView image; Uri fileuri;

Easy way to make an ImageView that is underneath a GridView match the GridView's size exactly?

橙三吉。 提交于 2019-12-25 01:55:58
问题 My ImageView is displaying an image of a chess style board for a little game I'm making. It is covered by a GridView that displays the images of my pieces. I have it displaying underneath but it is not positioned properly. I want it to match exactly the edges of the GridView but don't know how. Is there some way to make the GridView a "parent" of the ImageView so then I could say "match_parent" in the XML for it's height and width and so on? Here is a screen of how my app looks now. I want

Android GridView getChildAt(0).findViewById() returns null

邮差的信 提交于 2019-12-24 17:00:19
问题 I have a GridView with some items, I used a custom adapter that extends BaseAdapter . each row shows a downloadable item, each row has an icon that show download progress. So I need to update this icon. For this update, I know that I can change the data and call notifyDataChanged() and the view will get updated, but this approach costs me a lot of changes and I don't want to do this. So I tried to get a specific child from the gridview , find this icon and change the icon, But the returned

How to call the Gridview Activity from another activity

余生长醉 提交于 2019-12-24 14:14:45
问题 I need an idea on how to call an activity that has a gridview from another activity. Basically, supposed my main activity has one button and when you click the button you are directed to another activity with the following sample code public void onClick(View v){ if (v.getId() == R.id.button2) { Intent intent = new Intent(this, AnotherActivity.class); this.startActivity(intent); } } But what if the activity that I'm being redirected to contains a gridview layout, how do I call that when I

Refresh GridView contents with custom BaseAdapter

此生再无相见时 提交于 2019-12-24 12:37:56
问题 I've tried searching for a solution for this problem for a couple of days and I'm stumped. Here's what I have so far: Custom BaseAdapter class: public static class ImageAdapter extends BaseAdapter { private static LayoutInflater mInflater; // Keep all Images in array private static Bitmap[] mThumbIds; private static int mViewResourceId, pos; private static CheckBox cb; // Constructor public ImageAdapter(Context ctx, int viewResourceId, Bitmap[] pics) { mInflater = (LayoutInflater) ctx