tabHost+listview UI 界面---新手问题

丿渎灬魂 2011-09-15 10:43:07

如题。

类似微信的这种UI。

有的粘下。
刚刚接触。
谢谢。。



...全文
868 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
丿渎灬魂 2011-09-18
  • 打赏
  • 举报
回复
谢谢关注.
ch_984326013 2011-09-17
  • 打赏
  • 举报
回复
http://blog.csdn.net/ch_984326013/article/details/6602602上面那个是tabHost,至于listView你可以在布局中添加该控件就可了!
丿渎灬魂 2011-09-17
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 sunly4722 的回复:]
listView http://blog.csdn.net/xiaominghimi/article/details/6314704

[/Quote]

游戏开发的好资源...
sunly4722 2011-09-16
  • 打赏
  • 举报
回复
tab http://www.eoeandroid.com/thread-53207-1-1.html
listView http://blog.csdn.net/xiaominghimi/article/details/6314704
L475327192 2011-09-16
  • 打赏
  • 举报
回复
学习一下
leidetianshiyj 2011-09-16
  • 打赏
  • 举报
回复
首先是:TabBottomActivity

import android.app.TabActivity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Window;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class TabBottomActivity extends TabActivity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.tabview);

TabHost tabHost = getTabHost();
TabView view = null;

// 音乐包
view = new TabView(this, R.drawable.yyb, R.drawable.yyb_sel);
view.setBackgroundColor(Color.WHITE);
TabSpec spec1 = tabHost.newTabSpec("Music");
spec1.setIndicator(view);
Intent musicIntent = new Intent(this, MyMusicActivity.class);
spec1.setContent(musicIntent);

// 本地
view = new TabView(this, R.drawable.local, R.drawable.local_sel);
view.setBackgroundColor(Color.WHITE);
TabSpec spec2 = tabHost.newTabSpec("Local");
spec2.setIndicator(view);
Intent localIntent = new Intent(this, LocalActivity.class);
spec2.setContent(localIntent);

// 收藏
view = new TabView(this, R.drawable.fav, R.drawable.fav_sel);
view.setBackgroundColor(Color.WHITE);
TabSpec spec3 = tabHost.newTabSpec("Fav");
spec3.setIndicator(view);
Intent favIntent = new Intent(this, FavActivity.class);
spec3.setContent(favIntent);

// 搜索
view = new TabView(this, R.drawable.search, R.drawable.search_sel);
view.setBackgroundColor(Color.WHITE);
TabSpec spec4 = tabHost.newTabSpec("Search");
spec4.setIndicator(view);
Intent searchIntent = new Intent(this, SearchActivity.class);
spec4.setContent(searchIntent);

tabHost.addTab(spec1);
tabHost.addTab(spec2);
tabHost.addTab(spec3);
tabHost.addTab(spec4);
tabHost.setCurrentTab(0);
}

}


然后是:tabview.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost android:layout_width="fill_parent" android:background="@drawable/bg"
android:layout_height="fill_parent" android:id="@android:id/tabhost"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical"
android:padding="3dp">
<FrameLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@android:id/tabcontent"
android:layout_weight="1">
</FrameLayout>
<TabWidget android:layout_width="fill_parent"
android:layout_height="50dip" android:id="@android:id/tabs"
android:layout_alignBottom="@android:id/tabcontent" />
</RelativeLayout>
</TabHost>

最后是:MyMusicActivity
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;

public class MyMusicActivity extends Activity {
ListView listView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
listView = new ListView(this);
listView.setAdapter(new BaseAdapter() {

@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();
LinearLayout layout = (LinearLayout) inflater.inflate(
R.layout.music, null);
return layout;
}

@Override
public long getItemId(int position) {
return 0;
}

@Override
public Object getItem(int position) {
return null;
}

@Override
public int getCount() {
return 5;
}
});
setContentView(listView);
}

}

FavActivity\SearchActivity\LocalActivity,自己去定义好了
黄瓜黄瓜 2011-09-15
  • 打赏
  • 举报
回复
不搞UI ......帮顶....

80,349

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧