android-gridview

how to disable item in gridview in android

老子叫甜甜 提交于 2019-12-11 01:55:22
问题 There is imageview in my gridview.I want to disable current item/image which is clicked in gridview of android.I am not able to do this.how to do this?? here is a code- @Override public void onItemClick(AdapterView<?> arg0, View v, int no,long lg) { // TODO Auto-generated method stub final AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this); id=no; final EditText input = new EditText(MainActivity.this); alert.setView(input); alert.setPositiveButton("Check", new

Button width does not match parent android

心已入冬 提交于 2019-12-10 19:47:46
问题 I have the following xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:id="@+id/text_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center_horizontal|center_vertical" android:layout_marginTop="20dip" android:text="Fragment1" android:textAppearance="

Andrioid - Unable to re-create Canvas View dynamically

怎甘沉沦 提交于 2019-12-10 19:44:39
问题 I am trying to show a gridview of the canvas images that were drawn in the previous screen. I have a set of different views which is drawn in the first screen and those views are subjected to change, those canvas will be re drawn according to the user's actions. I have 5 heart shaped canvas views and I am using different views for every heart meaning that I am not using a same class to draw the five hearts, rather I am using 5 different class for 5 different hearts. These hearts will be

Android Grid view with 3 rows and 3 columns

℡╲_俬逩灬. 提交于 2019-12-10 14:17:29
问题 I unable to set no. of rows for grid view . Only able to set no. of columns. I need to create a grid view which has 3 rows and 3 columns. Can any one help me please. This is my XML layout code: <GridView android:id="@+id/gridView" android:layout_width="match_parent" android:layout_height="match_parent" android:numColumns="3" android:gravity="center" android:stretchMode="columnWidth" > </GridView> Thanks in advance, Deepak 回答1: Add this attribute to your android XML android:numColumns="3" This

Issue using GridView with ImageViews and TextViews

若如初见. 提交于 2019-12-10 13:57:26
问题 I'm trying to use a GridView with an ImageView and a TextView inside each cell. So i created the cell layout, the grid layout, the imageAdapter and the main activity, of course, but i keep getting the following problem: When i try this on the emulator, the initial images and captions are shown correctly but as soon as i scroll down, a few of the items start to mess up and keep changing and even duplicating some times. I'm using 2 parallel arrays (images and caption). I tried using the Log.v

Add extra space to bottom of a GridView or ListView

时光毁灭记忆、已成空白 提交于 2019-12-10 13:54:08
问题 Is it possible to add extra space (kinda like an empty row) to the bottom of a GridView? I would like it so when you scroll down to the bottom of a GridView, there will be an extra 50dp of empty space. I tried setting paddingBottom to 50dp, but it didn't seem to change anything. 回答1: If I understand you right, it should look like this: For that an easy solution is mentioned here by Maciej: How to add extra space inside at the bottom of a GridView You just need to add the following in your

Android - Get Color From ImageView with ColorFIlter Applied to Drawable

帅比萌擦擦* 提交于 2019-12-10 13:52:55
问题 I'm trying to get the color of an ImageView within a GridView that I've applied a color filter too previously. I'm running on a Nexus 4 with 4.2.2 I'm altering the color of the ImageView like this. The actual color of the image is white before I apply a filter. Drawable myIcon = getResources().getDrawable(R.drawable.bufferbuildercolor3); myIcon.setColorFilter(new PorterDuffColorFilter(Color.rgb(Color.red(color),Color.green(color), Color.blue(color)),PorterDuff.Mode.MULTIPLY)); Now this doesn

Image Gallery in Fragment Error

▼魔方 西西 提交于 2019-12-10 12:09:50
问题 I'm trying to make an app with an image gallery in it inside a fragment, but not getting errors in the code but getting this error below. Any help would be awesome, only a beginner. If you wish any more details just ask. Think its something to do with the 34th line which is: GridView gridview = (GridView) getView().findViewById(R.id.gridview); Code: public class Fragment_3 extends Fragment{ private static View view; @Override public View onCreateView(LayoutInflater inflater, ViewGroup

How to retain the checkbox state on scroll of gridview in android

ぐ巨炮叔叔 提交于 2019-12-10 10:33:05
问题 What i am doing :: I have a gridview where i am displaying images I adapter of the gridview has image and a checkbox What is happening :: When i check the checkbox and i scroll the gridview down & when i scrollback , the selected checkbox is unselected Question :: How can i prevent this What changes should i need to make in the code grid_view_image_item.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width=