HI
Thanks for the reply, my layout should look like a table with a scroll view, and a footer of 3 buttons,
i have designed a layout and here i am giving my code below, the table is coming to the entire page, i want to stop the table before footer. Please hlep !!
- Code: Select all
Gallery grid_main;
TableLayout table;
LinearLayout myLayout[] = new LinearLayout[44];
TextView myText[] = new TextView[4];
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.contacts_table);
table = (TableLayout)findViewById(R.id.ContactsLayout);
for(int i=0;i<44;i++) {
myLayout[i] = new LinearLayout(this);
for(int j=0;j<4;j++) {
myText[j] = new TextView(this);
myText[j].setText("asdf"+i+j);
myText[j].setPadding(0, 0, 20, 10);
myText[j].setClickable(true);
myText[j].setOnClickListener(this);
myLayout[i].addView(myText[j]);
}
myLayout[i].setClickable(true);
myLayout[i].setOnClickListener(this);
table.addView(myLayout[i]);
}
grid_main = (Gallery)findViewById(R.id.widget29);
grid_main.setAdapter(new ImageAdapter(this));
}
public class ImageAdapter extends BaseAdapter {
Context mContext;
public ImageAdapter(Context c){
mContext = c;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return 1;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View v = null;
if(convertView==null){
LayoutInflater li = getLayoutInflater();
v = li.inflate(R.layout.footer, null);
Button b1 = (Button)v.findViewById(R.id.widget40);
b1.setOnClickListener(TestActivity.this);
}else {
v = convertView;
}
return v;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
}
@Override
public void onClick(View v) {
System.out.println("Button 1 Pressed...");
}
and my layouts are : contacts_table.xml
- Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout android:id="@+id/widget0"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView android:id="@+id/widget41" android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableLayout android:id="@+id/ContactsLayout"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:stretchColumns="*"
android:layout_y="40px">
<TableRow android:id="@+id/widget106" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="#ff424142"
android:orientation="horizontal">
<TextView android:id="@+id/widget107" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Name">
</TextView>
<TextView android:id="@+id/widget108" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Acc Name">
</TextView>
<TextView android:id="@+id/amount" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Email">
</TextView>
<TextView android:id="@+id/amount" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Phone">
</TextView>
</TableRow>
</TableLayout>
</ScrollView>
<LinearLayout android:id="@+id/gallery_layou"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true">
<Gallery android:id="@+id/widget29" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_x="3px"
android:layout_y="363px">
</Gallery>
</LinearLayout>
</AbsoluteLayout>
footer.xml
- Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout android:id="@+id/widget0"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:id="@+id/widget38"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true">
<Button android:id="@+id/widget40" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Home">
</Button>
<Button android:id="@+id/widget39" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Test">
</Button>
</LinearLayout>
</AbsoluteLayout>