Tablayou嵌套ListView以及gallery实现手势滑动 支持多语言

我们的HW2 只能说现在写出来的android代码 丑的要哭了T T

Assignment具体可以看附件 懒得zip了直接快捷键rar

中间遇到的问题之多 超过我的想象呐 果然我是不会编程的人

1 一开始是看google developer上的tutorial 先是被Tablayout的getTabHost()给坑了一下 

   所以要注意 

public class HelloTabWidget extends TabActivity {

   继承的父类要写清楚哦! 

   这样说来 stackoverflow 真的是好物 直接google一下全部出来啦

2 卡了我半天的是imageView 居然 实现起来傻逼的不行 但是网上的代码都只有xml了没有java的 这里写清楚了 为小白们谋福利

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".ImgActivity" >

	<ImageView
	    android:id="@+id/imgView1"
	    android:layout_width="fill_parent"
        android:layout_height="fill_parent"
	    android:src="@drawable/pic_14"
	    android:layout_gravity="center"
	    />

</RelativeLayout>

    

package com.example.hw2;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ImageView;
import android.widget.TextView;

public class ImgActivity extends Activity {
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_img);
	}
}

3 接下来是最最烦人的手势滑动实现,一开始一直用viewFlipper,网上例子也是一堆的,但是单独运行是正常的程序,整合进tablayout以后就不行了,非常捉急,但是又不想用复杂高深的gallery,以至于周日做的拖到现在才搞完。

    其实正解就是,viewflipper根本不能嵌套?这不可能吧!谁能来解释下呢???

    最后还是用gallery实现的,代码短小简单的不行,基本上直接用了http://my.oschina.net/yuhanxun/blog/88019的程序。

4 多语言支持这个就比较简单啦 不过要记住中文是zh-CN哦,我第一次用的是zn-CN,结果又是半天不能转中文,急死= =

猜你喜欢

转载自kmo.iteye.com/blog/1827892