hi please help
actually i m trying to make list view as invisible
but its showing the listview and gridview both at one time please help in solving it.
here is the code.
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
Gallery gallery = (Gallery) findViewById(R.id.gallery1);
lst=(ListView)findViewById(R.id.list);
lst.setVisibility(View.INVISIBLE);
// ViewManager hi=(ViewManager)getBaseContext().getSystemService(WINDOW_SERVICE );
gallery.setAdapter(new ImageAdapter(this));
final GridView gridView = (GridView) findViewById(R.id.gridview);
mInflater = (LayoutInflater) getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
data = new Vector<RowData>();
for(int i=0;i<title.length;i++){
try {
rd = new RowData(i,title[i],detail[i]);
} catch (ParseException e) {
e.printStackTrace();
}
data.add(rd);
lst.setAdapter(new CustomAdapter(this, R.layout.list,R.id.title,data));
}
gridView.setAdapter(new ImageAd(this));
final TabHost tabs=(TabHost)findViewById(R.id.tabhost);
tabs.setup();
final TabHost.TabSpec spec=tabs.newTabSpec("buttontab");
final TabHost.TabSpec spec1=tabs.newTabSpec("btn");
spec.setContent(R.id.list);
lst.setVisibility(View.INVISIBLE);
spec1.setContent(R.id.buttontab);
spec.setIndicator("tab1");
spec1.setIndicator("tab1");
tabs.addTab(spec);
tabs.setCurrentTab(0);
tabs.getTabWidget().getChildAt(0).setLayoutParams(new
LinearLayout.LayoutParams(30,30));
spec.setIndicator("tab2");
tabs.addTab(spec);
tabs.getTabWidget().getChildAt(1).setLayoutParams(new
LinearLayout.LayoutParams(30,30));
tabs.setOnTabChangedListener(new OnTabChangeListener(){
#Override
public void onTabChanged(String tabId) {
if(tabId=="buttontab")
and here is xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50px"
android:orientation="horizontal">
<Button
android:id="#+id/login"
android:layout_width="80px"
android:layout_height="wrap_content"
android:text="Login"
/>
<TextView
android:paddingLeft="80px"
android:id="#+id/search"
android:layout_width="40px"
android:text="Search"
android:layout_height="wrap_content"
/>
<EditText
android:layout_width="100px"
android:layout_height="wrap_content"
/>
</LinearLayout>
<Gallery
android:id="#+id/gallery1"
android:layout_width="fill_parent"
android:layout_height="50px" />
<TabHost android:id="#+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<FrameLayout android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="62px">
<ListView android:id="#+id/list"
android:layout_width="fill_parent"
android:layout_height="200px" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/gridview"
android:layout_width="fill_parent"
android:layout_height="200px"
android:numColumns="4"
android:verticalSpacing="5px"
android:horizontalSpacing="5px"
android:columnWidth="60dp"
android:stretchMode="columnWidth"
android:gravity="center"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<Button
android:id="#+id/buttontab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon"/>
<ImageButton
android:id="#+id/hello1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon"/>
<ImageButton
android:id="#+id/hello3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon"/>
<ImageButton
android:id="#+id/hello4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon"/>
<ImageView
android:id="#+id/hello5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon"/>
</LinearLayout>
</LinearLayout>>
</FrameLayout>
</TabHost>
</LinearLayout>
so please help to make listview as invisiblei know its a very little mistake but unable to solve the error
Try View.GONE instead of View.INVISIBLE
Since you are doing this in onCreate you could do it in your XML:
<ListView
android:id="#+id/list"
android:layout_width="fill_parent"
android:layout_height="200px"
android:visibility="gone"
/>
Related
I have a listview between header and button, I want to add textview just above listview and button to align properly so that button do not override listview items. How can i do that? Not sure what is the issue with xml layout
layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#e7ebee"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="452dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/mainheader"
android:layout_width="fill_parent"
android:layout_height="52dp"
android:background="#0a2436">
<RelativeLayout
android:id="#+id/subheader"
android:layout_width="wrap_content"
android:layout_height="52dp" >
<ImageView
android:id="#+id/back"
android:layout_width="40dip"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="#drawable/my_highlight_drawable"
android:src="#drawable/back" />
<ImageView
android:id="#+id/inboxheader"
android:layout_width="2dip"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:layout_toRightOf="#+id/back"
android:background="#85929B"
android:paddingBottom="15dip"
android:paddingTop="15dip" />
</RelativeLayout>
<ImageView
android:id="#+id/windowtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:contentDescription="#null"
android:src="#drawable/logo" />
</RelativeLayout>
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:divider="#android:color/darker_gray"
android:dividerHeight="1dip"
android:drawSelectorOnTop="false"
android:focusable="false"
android:paddingTop="0dip" />
<TextView
android:id="#+id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:text="No Data Available"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:gravity="bottom">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#092435"
android:gravity="center_horizontal" >
<Button
android:id="#+id/btnManualLookup"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#4982AE"
android:gravity="center"
android:padding="15dip"
android:text="Submit"
android:textColor="#ffffff" />
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
Have you considered adding a headerview to listview. You could actually use a layout as header for listview. This way, you views on header will never overflow on to listview.
final ListView lstVRHDetails = (ListView) getActivity().findViewById(R.id.listview);
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View headerView = inflater.inflate(<header layout>, new LinearLayout(getActivity()), false);
headerView.findViewById(R.id.rlFromDate).setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
}
});
headerView.findViewById(R.id.rlToDate).setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
}
});
headerView.findViewById(R.id.imgUpdate).setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
}
});
headerView.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.WRAP_CONTENT));
lstVRHDetails.addHeaderView(headerView);
I am using a layout with Gridview by custom library Click here StaggeredGridView
But not achieved the result that I needed.
Th GridView should auto adjust its column and row depending upon the number of images (min 1 images & max 4 images ) like here
news_default.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/lib/com.rb.nonstop.HomeActivity"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RelativeLayout android:id="#+id/rel_sender_photo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip">
<ImageView
android:id="#+id/img_news_sender_photo"
android:layout_width="70dip"
android:layout_height="70dip"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="#drawable/ic_launcher" />
<com.devspark.robototextview.widget.RobotoTextView
android:id="#+id/txt_category"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/img_news_sender_photo"
android:textColor="#343434"
android:textSize="15dip"
android:text="News"
android:paddingLeft="5dip"
android:paddingTop="10dip"
/>
<View
android:id="#+id/view1"
android:layout_width="100dp"
android:layout_height="2dp"
android:background="#color/border"
android:layout_toRightOf="#+id/img_news_sender_photo"
android:layout_below="#+id/txt_category"
android:paddingLeft="20dip"
android:paddingTop="5dip" />
<com.devspark.robototextview.widget.RobotoTextView
android:id="#+id/txt_sender_name_location"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/img_news_sender_photo"
android:layout_below="#+id/view1"
android:textColor="#343434"
android:textSize="15dip"
android:text="Karthik Kolanji, Mumbai"
android:paddingLeft="5dip"
android:paddingTop="5dip"
/>
</RelativeLayout>
<RelativeLayout android:id="#+id/rel_news_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip"
android:layout_below="#+id/rel_sender_photo">
<com.rb.lined.edittext.LinedEditText
android:id="#+id/edit_news"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#null"
android:inputType="textMultiLine|textNoSuggestions"
android:padding="10dip"
android:singleLine="false"
android:imeOptions="actionNone"
android:textSize="10sp"
android:gravity="top|left"
android:minLines="10"
/>
</RelativeLayout>
<RelativeLayout android:id="#+id/rel_news_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip"
android:layout_below="#+id/rel_news_content"
>
<com.devspark.robototextview.widget.RobotoTextView
android:id="#+id/txt_app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#343434"
android:textSize="10dip"
android:text="NewsFirst MobileApp"
android:paddingLeft="5dip"
android:paddingTop="5dip"
android:layout_alignParentLeft="true"
/>
<com.devspark.robototextview.widget.RobotoTextView
android:id="#+id/txt_news_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#343434"
android:textSize="10dip"
android:text="September 10,2014 4:20 PM"
android:paddingLeft="5dip"
android:paddingTop="5dip"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
<RelativeLayout android:id="#+id/rel_news_grid_photos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip"
android:layout_below="#+id/rel_news_date"
>
<com.jake.quiltview.QuiltView
android:id="#+id/quilt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dip"
app:scrollOrientation="horizontal|vertical" >
</com.jake.quiltview.QuiltView>
</RelativeLayout>
</RelativeLayout>
activity_home.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.rb.nonstop"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<include android:id="#+id/rel_news_default"
layout="#layout/news_default"/>
</RelativeLayout>
HomeActivity.java
public class HomeActivity extends Activity{
public QuiltView quiltView;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_home);
quiltView = (QuiltView) findViewById(R.id.quilt);
quiltView.setChildPadding(5);
addTestQuilts(200);
}
public void addTestQuilts(int num){
ArrayList<ImageView> images = new ArrayList<ImageView>();
for(int i = 0; i < num; i++){
ImageView image = new ImageView(this.getApplicationContext());
image.setScaleType(ScaleType.CENTER_CROP);
if(i % 2 == 0)
image.setImageResource(R.drawable.app_logo);
else
image.setImageResource(R.drawable.app_logo1);
images.add(image);
}
quiltView.addPatchImages(images);
}
}
I would suggest you to use RecyclerView with StaggeredGridLayoutManager.
There is a great tutorial on the official documentation.
I try to desin a screen , which is a layout of a fragment like this
https://dl.dropboxusercontent.com/u/37599516/Untitled.png
Or like this in instagram
https://dl.dropboxusercontent.com/u/37599516/Screenshot%202014-01-09%2010.27.19.png
i try this code :
<LinearLayout
android:id="#+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/relativeLayout1"
android:layout_marginRight="5dip"
android:background="#drawable/image_bg"
android:padding="3dip" >
<ImageView
android:id="#+id/userAvatar"
android:layout_width="wrap_content"
android:layout_height="89dp"
android:src="#drawable/test_avatar" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/thumbnail"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/thumbnail"
android:layout_below="#+id/relativeLayout1"
android:layout_toRightOf="#+id/thumbnail"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="soloco bolo"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/ImageView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="#drawable/description_section_icon" />
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="123456"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="#drawable/ic_menu_add" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="123dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="#+id/button2"
style="?android:attr/buttonStyleSmall"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/thumbnail" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal"
android:text="Đà Nẵng"
android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/textView4"
android:layout_width="match_parent"
android:layout_height="68dp"
android:gravity="center_horizontal|center_vertical"
android:text="Activate"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal|center_vertical"
android:text="6/1/2013-7/1/2013"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/containerTabhost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/relativeLayout2"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/linearLayout1"
android:background="#drawable/backgroundactionbar"
android:orientation="vertical" >
<TabHost
android:id="#+id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.30" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="92dp" >
</TabWidget>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/tab1list_place_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#b5b5b5"
android:dividerHeight="1dp"
android:listSelector="#drawable/list_selector" >
</ListView>
</LinearLayout>
<LinearLayout
android:id="#+id/tab2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/tab2list_place_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#b5b5b5"
android:dividerHeight="1dp"
android:listSelector="#drawable/list_selector" />
</LinearLayout>
<LinearLayout
android:id="#+id/tab3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/tab3list_place_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#b5b5b5"
android:dividerHeight="1dp"
android:listSelector="#drawable/list_selector" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
and using this code to work with tab host in my fragment class
public class HostFragment extends Fragment {
private FragmentTabHost mTabHost;
public HostFragment() {
// Empty constructor required for fragment subclasses
}
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_host_layout,
container, false);
setHasOptionsMenu(true);
TabHost mTabHost = (TabHost) rootView.findViewById(R.id.tabhost);
mTabHost.setup( );
TabSpec photospec = mTabHost.newTabSpec("Search");
photospec.setIndicator("Search",
getResources().getDrawable(R.drawable.action_search));
Intent searchIntent = new Intent(getActivity(),
HostViewIntroduce.class);
photospec.setContent(searchIntent);
TabSpec songspec = mTabHost.newTabSpec("Favorites");
songspec.setIndicator("Favorites",
getResources().getDrawable(R.drawable.action_search));
Intent favoriteIntent = new Intent(getActivity(),
HostViewTips.class);
songspec.setContent(favoriteIntent);
mTabHost.addTab(songspec);
mTabHost.addTab(photospec);
return rootView;
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
return super.onOptionsItemSelected(item);
}
}
and it throw nullpointer exception
01-09 13:40:31.781: E/AndroidRuntime(5871): FATAL EXCEPTION: main
01-09 13:40:31.781: E/AndroidRuntime(5871): java.lang.IllegalStateException: Did you forget to call 'public void setup(LocalActivityManager activityGroup)'?
You need to use FragmentTabHost's custom addTab() which will also take your Fragment class as parameter.
Replace
TabSpec photospec = mTabHost.newTabSpec("Search");
photospec.setIndicator("Search",
getResources().getDrawable(R.drawable.action_search));
Intent searchIntent = new Intent(getActivity(),
HostViewIntroduce.class);
photospec.setContent(searchIntent);
TabSpec songspec = mTabHost.newTabSpec("Favorites");
songspec.setIndicator("Favorites",
getResources().getDrawable(R.drawable.action_search));
Intent favoriteIntent = new Intent(getActivity(),
HostViewTips.class);
songspec.setContent(favoriteIntent);
with
TabHost.TabSpec photospec = mTabHost.newTabSpec("Search");
photospec.setIndicator("Search",
getResources().getDrawable(R.drawable.action_search));
photospec.setIndicator(rootView);
mTabHost.addTab(photospec, HostViewIntroduce.class, null);
TabSpec songspec = mTabHost.newTabSpec("Favorites");
songspec.setIndicator("Favorites",
getResources().getDrawable(R.drawable.action_search));
songspec.setIndicator(rootView);
mTabHost.addTab(songspec, HostViewTips.class, null);
I am trying to import my ListView but for some reason my program cannot detect my listview ID. I have tried cleaning project and restarting eclipse but i am getting the same results
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.firstlist);
testcontacts = getResources()
.getStringArray(R.array.testcontacts_array);
aa = new MessageView();
lv = (ListView) findViewById(R.id.list);
lv.setAdapter(aa);
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// When clicked, show a toast with the TextView text
Toast.makeText(getApplicationContext(),
((TextView) view).getText(), Toast.LENGTH_SHORT).show();
}
});
}
Here is my Listview xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/top_control_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="#cc252a"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:text="This will be Changed"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
<LinearLayout
android:id="#+id/bottom_control_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
</LinearLayout>
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_above="#id/bottom_control_bar"
android:layout_below="#id/top_control_bar"
android:choiceMode="multipleChoice" >
</ListView>
</RelativeLayout>
Here are my list view items format:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip" >
<ImageView
android:id="#+id/icon1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_marginRight="6dip"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/secondLine"
android:layout_width="fill_parent"
android:layout_height="26dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_toRightOf="#id/icon1"
android:ellipsize="marquee"
android:singleLine="true"
android:text="Some more information" />
<TextView
android:id="#+id/firstLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#id/secondLine"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_toRightOf="#id/icon1"
android:gravity="center_vertical"
android:text="Some Information" />
<ImageView
android:id="#+id/icon2"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="6dip"
android:src="#drawable/ic_launcher" />
</RelativeLayout>
Isn't it supposed to be
<ListView
android:id="#+id/list"
instead of
<ListView
android:id="#android:id/list"
i have a list view which shows 3 headings id , name and type and at last there is a line of checkbox what i want is
if i click value of 1st three heading it should be open in a drill down one more listview while when i check my checkbox which is at last only checkbox is checked no other action should take place
my code s here as below
sfreport.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="#EFEFF7"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:paddingLeft="2px"
android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal">
<TextView android:text="ID" android:width="80dip" android:layout_width="wrap_content"
android:layout_height="fill_parent" style="#style/hdrListing" android:height="25sp" />
<TextView android:text="Name" android:layout_weight="1.0" android:layout_width="wrap_content"
android:layout_height="fill_parent" style="#style/hdrListing" android:height="25sp" />
<TextView android:text="Type" android:width="80dip" android:layout_width="wrap_content"
android:layout_height="fill_parent" style="#style/hdrListing" android:height="25sp" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:paddingLeft="2px"
android:paddingRight="2px" android:background="#000000"
android:layout_width="fill_parent" android:layout_height="2px" android:orientation="horizontal">
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:paddingLeft="2px"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#EFEFF7">
<ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="#id/android:list"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#EFEFF7"
android:choiceMode="multipleChoice" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="bottom"
android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="#+id/ll6" />
</LinearLayout>
while my other xml where i set the value is
<?xml version="1.0" encoding="utf-8"?>
<SRTekBox.Android.SRSD.widget.CheckableLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:DRST="http://schemas.android.com/apk/res/SRTekBox.Android.SRSD" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#color/list_bg">
<TextView android:id="#+id/itemID" android:width="80dip"
android:layout_centerVertical="true" android:textColor="#000000" android:focusable="false"
android:layout_width="wrap_content" android:layout_height="fill_parent" />
<TextView android:id="#+id/itemCaption" android:layout_weight="1.0"
android:layout_centerVertical="true" android:textColor="#000000" android:focusable="false"
android:layout_width="wrap_content" android:layout_height="fill_parent"/>
<TextView android:id="#+id/itemType" android:width="80dip" android:gravity="center"
android:layout_centerVertical="true" android:textColor="#000000" android:focusable="false"
android:layout_width="wrap_content" android:layout_height="fill_parent"/>
<SRTekBox.Android.SRSD.widget.InertCheckBox android:id="#+id/itemCheckBox"
android:layout_width="19dip" android:layout_height="fill_parent" android:focusable="false"
android:layout_centerVertical="true" android:button="#drawable/checkbox" android:width="19px" />
</SRTekBox.Android.SRSD.widget.CheckableLinearLayout>
this is my java code--->
/* public void onListItemClick(ListView parent,View v,int position,long id){
TextView t=(TextView)v.findViewById(R.id.itemID);
TextView t4=(TextView)v.findViewById(R.id.itemCaption);
TextView t5=(TextView)v.findViewById(R.id.itemType);
String sID="";
String sName="";
String SType="";
sID = t.getText().toString();
sName = t4.getText().toString();
SType=t5.getText().toString();
//v.setBackgroundColor(Color.rgb(119,136,153));
if("".equals(sID) || "MY VISIT SUMMARY".equals(sDesc)){
return;
}
if("0".equals(sName)){
return;
}
if("SA-E".equals(SType)){
Intent intent=new Intent(this,SRSDReportsDrillDown.class);
startActivity(intent);
}
}*/
public void onListItemClick(ListView parent,View v,int position,long id){
try{
if(listView.isItemChecked(position)){
int idx=position;
Integer listCount=listView.getCount();
for(Integer xx=0;xx<listCount;xx++){
if(idx==xx){
listView.setItemChecked(xx,true);
popup();
}
else{
}
return;
}
}
}
catch(Exception ex){
MsgBox1(this,ex.toString());
}
}