編輯:關於Android編程
這個是一個item的單元格樣式的,有圖片和文字
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.Activity;
import android.os.Bundle;
import android.widget.GridView;
public class MainActivity extends Activity {
private GridView gridView;
private GridViewAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// 設置適配器的圖片資源
int[] imageId = new int[] { R.drawable.chat_tool_camera,
R.drawable.chat_tool_location, R.drawable.chat_tool_paint,
R.drawable.chat_tool_video, R.drawable.chat_tool_voice,
R.drawable.chat_tool_camera, R.drawable.chat_tool_location,
R.drawable.chat_tool_paint, R.drawable.chat_tool_video,
R.drawable.chat_tool_voice, R.drawable.chat_tool_camera,
R.drawable.chat_tool_location, R.drawable.chat_tool_paint,
R.drawable.chat_tool_video, R.drawable.chat_tool_voice,
R.drawable.chat_tool_camera, R.drawable.chat_tool_location,
R.drawable.chat_tool_paint, R.drawable.chat_tool_video,
R.drawable.chat_tool_voice };
// 設置標題
String[] title = new String[] { "相機", "定位", "畫筆", "視頻", "聲音", "相機",
"定位", "畫筆", "視頻", "聲音", "相機", "定位", "畫筆", "視頻", "聲音", "相機",
"定位", "畫筆", "視頻", "聲音" };
List
這個是適配器
import java.util.List;
import java.util.Map;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class GridViewAdapter extends BaseAdapter {
private Context context;
private List> listitem;
public GridViewAdapter(Context context,List> listitem) {
this.context = context;
this.listitem = listitem;
}
@Override
public int getCount() {
return listitem.size();
}
@Override
public Object getItem(int position) {
return listitem.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(context).inflate(R.layout.gridview_item, null);
}
ImageView imageView = (ImageView) convertView.findViewById(R.id.image);
TextView textView = (TextView) convertView.findViewById(R.id.textView);
Map map = listitem.get(position);
imageView.setImageResource((Integer) map.get("image"));
textView.setText(map.get("title") + "");
return convertView;
}
}
效果圖如下:
天天P圖作為圖像處理類APP,內部集成了很多功能,包括濾鏡、人臉檢測、美白、磨皮、美妝、拼圖、相機等,而且這些功能多是用底層算法依靠GPU實現,如何保證這些功能在眾廠商生
開發背景最近是在做一個與健身相關的APP,裡面有訓練器模塊基本功能是按照特點動作的演示和描述來引導用戶完成訓練。在第一個版本時由於沒接觸過些類項目與功能花了幾周的時間大概
自己寫的安卓的計算器:注:這個是在mac中開發的,如果要在windows的eclipse中運行可能會出現路徑問題,解決辦法從windows中已有的安卓工程根目錄下復制一下
Android平台api沒有特意為換膚提供一套簡便的機制,這可能是外國的軟件更注重功能和易用,不流行換膚。系統不提供直接支持,只能自行研究。 換膚,可以認為是動態替換資源