我想实现一个可靠的系统来创建自定义的Grouped Tableview,就像使用表的自定义样式的应用程序ConvertBot一样.
http://i.stack.imgur.com/geAuw.png
我会得到相同的效果使用背景图像插入单元格的backgroundView这是我正在使用的代码.
使用的代码
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = (UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.textLabel.text = [NSString stringWithFormat:@"Cell Name %d %d",indexPath.row,indexPath.section];
cell.textLabel.backgroundColor = [UIColor clearColor];
//
// Create a custom background image view.
//
cell.backgroundView =
[[[UIImageView alloc] init] autorelease];
cell.selectedBackgroundView =
[[[UIImageView alloc] init] autorelease];
UIImage *rowBackground;
UIImage *selectionBackground;
NSInteger sectionRows = [self.tableView numberOfRowsInSection:[indexPath section]];
NSInteger row …Run Code Online (Sandbox Code Playgroud) 其实我试图在Android Drawer示例中实现Google Map,基本上我想通过选择第一个菜单项来显示地图.所有提供的示例都是对所有地图使用FragmentActivity,我安排扩展Fragment类(由抽屉使用),创建一个适合Map的类.不幸的是App在发布时崩溃:
主要活动
public class HLMainActivity extends ActionBarActivity implements
NavigationDrawerFragment.NavigationDrawerCallbacks {
/**
* Fragment managing the behaviors, interactions and presentation of the
* navigation drawer.
*/
private NavigationDrawerFragment mNavigationDrawerFragment;
/**
* Used to store the last screen title. For use in
* {@link #restoreActionBar()}.
*/
private CharSequence mTitle;
public static FragmentManager fragmentManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hlmain);
// initialising the object of the FragmentManager. Here I'm passing getSupportFragmentManager(). You can pass getFragmentManager() if you are coding …Run Code Online (Sandbox Code Playgroud) android google-maps android-fragments google-maps-android-api-2