android-listview

Highlight ListView item at creation time via code

谁都会走 提交于 2019-12-24 01:27:49
问题 I would like to highlight the first row (0) of my ListView when I create the listView. I tried different ways (like you can see in the commented code), but nothing worked. It's strange because the highlight in the OnItemClickListener WORKS FINE! (It works via an xml selector). I have this method in my fragment that it's called by onCreateView: private void createListViewAll(View rootView, int listID, String[][] textList) { MainListAdapter bindingData = new MainListAdapter(getActivity(),

Zoom Image View on pull down

邮差的信 提交于 2019-12-24 01:19:18
问题 I have a view with structure like <ScrollView> <RelativeLayout> <ImageView> <LinearLayout> <!-- Here I show some details in textview--> </LinearLayout> </RelativeLayout> </ScrollView> Now I what i want is when i scroll down or drag down the linear layout I want to increase the ImageView size with the scroll down amount and when I release the drag/scroll it should become as initial size.This is done in Path android app. I need idea to achieve this, please help if anybody did this. 来源: https:/

StickyListHeaders and MergeAdapter

血红的双手。 提交于 2019-12-24 01:18:36
问题 I've got a layout that I'm trying to set up that is comprised of three different layouts merged into one. I have two RelativeLayouts as the first two items and a list adapter as the third. The reason for using MergeAdapter is because I want the entire page to scroll, but I want the second total item in the entire layout (the second RelativeLayout) to stick to the top. So I'm trying to use the StickyListHeaders Library to accomplish it. It doesn't seem like it's too widely used yet, even

Add Image at above of listview

我与影子孤独终老i 提交于 2019-12-24 01:01:54
问题 I would like to add imageview at above of listview. I knew about add section hearder in listview. But i just wanna save my time so i used image view for listview header instead of using addSectionHeader. Unfortunately i just stuck in with some xml properties. Image Overlay at my list view. Actually image supposed to be at the above of list. Check out my xml layout. Thanks. <?xml version="1.0" encoding="utf-8"?> 回答1: this link states the same as of your problem EditText wont display above

android - TwoLineListItem text alignment

元气小坏坏 提交于 2019-12-24 00:56:01
问题 I am using a twolinelistitem for displaying two lines in each list item - Name and Summary. The Summary is a little big to fit in one line, thus when i display on screen, the summary gets cut and doesnt look good. What is the way to make sure the that the whole summary is visible in the list item? here's the code - <TwoLineListItem android:paddingTop="2dip" android:paddingBottom="2dip" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" android

NullPointerException related to android.widget.AbsListView.obtainView(AbsListView.java:2275)

孤街醉人 提交于 2019-12-24 00:48:01
问题 i have a problem figure out where to start debugging. this is the information from logcat: 01-22 18:28:20.472: E/AndroidRuntime(10859): FATAL EXCEPTION: main 01-22 18:28:20.472: E/AndroidRuntime(10859): java.lang.NullPointerException 01-22 18:28:20.472: E/AndroidRuntime(10859): at android.widget.AbsListView.obtainView(AbsListView.java:2275) 01-22 18:28:20.472: E/AndroidRuntime(10859): at android.widget.ListView.measureHeightOfChildren(ListView.java:1244) 01-22 18:28:20.472: E/AndroidRuntime

Android: Checkbox in ExpandableListView not triggering onChildClick even with focusable=false

╄→гoц情女王★ 提交于 2019-12-24 00:35:58
问题 Goal: I am trying to create a UI with 2 checkboxes per line, each line seperated into sections. I've included a screenshot of the UI below. Current approach: I am using an ExpandableListView and handeling the data with an onChildClick. Problem: When you click a checkbox, it does not trigger onChildClick or anything else. Clicking anywhere outside of the checkbox will trigger this event. Research: There are lots of threads that suggest setting android:focusable="false", but that doesn't change

NullPointerException when using ListView inside a ViewStub

为君一笑 提交于 2019-12-23 23:17:03
问题 I'm trying to create a ListView inside a ViewStub, but i keep on getting a NullPointerException . My Buttons works as intended inside the ViewStub. The code that fails is as following: else if(v.getId() == R.id.comments_button_series_view){ if(stubUsed == false){ stub = (ViewStub) findViewById(R.id.stub); View inflatedStub = stub.inflate(); String[] comments = new String[]{"comment1", "comment2"}; commentsAdapter = new ArrayAdapter<String>(this, R.layout.patient_list_element, R.id.comments

How to store value of spinner button in sqlite database

﹥>﹥吖頭↗ 提交于 2019-12-23 23:03:07
问题 As i am new in Android development I dnt know how to store selected value of a spinner in sqlite database. Here is the java code. Also inside onClick savebutton the following line is an error: String age = sp.getText().toString() public class SqlLiteExample extends Activity implements OnClickListener, OnItemSelectedListener{ Button sqlUpdate, sqlView; EditText etName,etContact; RadioGroup myRadioGrp; RadioButton rbtn1,rbtn2; Spinner sp; @Override protected void onCreate(Bundle

Multiply textviews in a listview

那年仲夏 提交于 2019-12-23 22:57:43
问题 There are 2 text views in each row, basically a Title and then a description underneath it. How do I set the text of each view within each row? @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRoot = inflater.inflate(R.layout.frag_settings, container, false); mItems = getResources().getStringArray(R.array.setting_items); mItemDescription = getResources().getStringArray(R.array.setting_item_descriptions); mItemListView = (ListView)