android平台的左右上下都能滚动的效果
2013-08-09 11:50:31 来源:WEB开发网代码如下
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);
- ››Android 当修改一些代码时,使用什么编译命令可以最...
- ››Android 如何添加一个apk使模拟器和真机都编译进去...
- ››Android 修改Camera拍照的默认保存路径
- ››Android 如何修改默认输入法
- ››android开发中finish()和System.exit(0)的区别
- ››Android手势识别简单封装类
- ››android中查看项目数字证书的两种方法
- ››Android中获取IMEI码的办法
- ››android 相机报错 setParameters failed
- ››Android重启运用程序的代码
- ››Android为ListView的Item设置不同的布局
- ››android bitmap与base64字符串的互相转换
更多精彩
赞助商链接