WEB开发网
开发学院手机开发Android 开发 android平台的左右上下都能滚动的效果 阅读

android平台的左右上下都能滚动的效果

 2013-08-09 11:50:31 来源:WEB开发网   
核心提示: 代码如下public class GroupActivity extends Activity {private List<TeamBean> gbList;// private MyListAdapter adapter;private ItemClickEvent listener;//

 代码如下

public class GroupActivity extends Activity {

private List<TeamBean> gbList;
// private MyListAdapter adapter;
private ItemClickEvent listener;
// private MyHandler handler;
private GridView[] gridvs ;

//
private LinearLayout ll_main;
private ScrollView scll ;
private LinearLayout scll_sub_ll;
private HorizontalScrollView hls;
private LinearLayout hls_sub_ll;
private GridView gv ;
private LinearLayout.LayoutParams ll_pmm;
private LinearLayout.LayoutParams ll_pmw;
private LinearLayout.LayoutParams ll_pww;
private LinearLayout.LayoutParams ll_head_wh;
private int headViewW = 0, headViewH = 0;

private TextView tv_type;
private View headView;
private LayoutInflater flater;
private Button bt_back, bt_right;
private TextView top_title;
private MyListAdapter[] myAdaps;


Handler hand = new Handler(){
public void handleMessage(Message msg) {
switch (msg.what) {
case 1:
Log.i("AAA","case1 "+msg.what);
if(null == gbList || gbList.size() < 0){
return;
}

init();

break;

case 2:
setContentView(ll_main);
break;
default:
break;
}
};
};

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
// setContentView(R.layout.main);

new Thread() {
@SuppressLint("NewApi")
public void run() {
gbList = new ArrayList<TeamBean>();
for (int i = 0; i < 10; i++) {

TeamBean item = new TeamBean("abc" + i, "123456"
+ i);
Log.i("AAA","item = "+item);
gbList.add(item);
}
Message msg = Message.obtain();
msg.what = 1;
hand.sendMessage(msg);
}
}.start();

}
private void init(){
headView = getLayoutInflater().inflate(R.layout.dingbujiemian, null);
headView.setBackgroundResource(R.drawable.top_bg);

bt_back = (Button) headView.findViewById(R.id.zuobiananniu);
bt_back.setVisibility(View.VISIBLE);
bt_back.setBackgroundResource(R.color.transparent);
bt_back.setText(getResources().getString(R.string.fanhui));
bt_back.setOnClickListener(new OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub
finish();
}
});
bt_right = (Button) headView.findViewById(R.id.youbiananniu);
bt_right.setVisibility(View.INVISIBLE);
top_title = (TextView) headView.findViewById(R.id.zhongjianzifu);
top_title.setVisibility(View.INVISIBLE);


ll_pmm = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
ll_pmw = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
ll_pww = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

1 2 3  下一页

Tags:android 平台 左右

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接