public
class
MainActivity
extends
ListActivity
{
private
String[] ss =
new
String[]{
"title1"
,
"content"
,
"content"
,
"title2"
,
"content"
,
"content"
,
"content"
,
"content"
};
@Override
protected
void
onCreate(Bundle savedInstanceState)
{
super
.onCreate(savedInstanceState);
setListAdapter(
new
BaseAdapter()
{
@Override
public
View getView(
int
position, View convertView, ViewGroup parent)
{
LayoutInflater inflater = getLayoutInflater();
TextView textView =
null
;
if
(position ==
0
|| position ==
3
)
{
textView = (TextView) inflater.inflate(R.layout.mylayout,
null
);
}
else
{
textView = (TextView) inflater.inflate(android.R.layout.simple_list_item_1,
null
);
}
textView.setText(ss[position]);
return
textView;
}
@Override
public
int
getCount()
{
return
ss.length;
}
@Override
public
boolean
areAllItemsEnabled()
{
return
false
;
}
@Override
public
boolean
isEnabled(
int
position)
{
if
(position ==
0
|| position ==
3
)
{
return
false
;
}
else
{
return
true
;
}
}
@Override
public
long
getItemId(
int
position)
{
return
0
;
}
@Override
public
Object getItem(
int
position)
{
return
null
;
}
});
}
@Override
public
boolean
onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.menu.activity_main, menu);
return
true
;
}
}