(转摘)Android腾讯微薄客户端开发九:博主详情界

系统 1980 0
(转摘)Android腾讯微薄客户端开发九:博主详情界面篇(广播,听众,收听)
点击顶部的标题栏,界面跳转到此博主的关注界面
(转摘)Android腾讯微薄客户端开发九:博主详情界面篇(广播,听众,收听)
关注界面,此界面下面的对话和点评以及上面的广播,听众和收听丑了点,没时间了,我今天要把博客弄完,美化的事情交给你们了。
Java代码 复制代码   收藏代码
  1. public   class  UserInfoActivity  extends  Activity  implements  OnItemClickListener{   
  2.      private  String currentNick;   
  3.      private  String name;   
  4.      private  String origtext;   
  5.      private  String timestamp;   
  6.      private  DataHelper dataHelper;   
  7.      private  UserInfo user;   
  8.      private  MyWeiboSync weibo;   
  9.      private  Handler handler;   
  10.      private  AsyncImageLoader asyncImageLoader;    
  11.      private  UserInfoThread thread;   
  12.      private  String weiboid;   
  13.      private  String returnJsonStr;   
  14.      private  JSONObject dataObj ;   
  15.      private  ImageView user_headicon;   
  16.      private  TextView user_nick;   
  17.      private  TextView user_name;   
  18.      private  TextView user_origtext;   
  19.      private  TextView user_time;   
  20.      private  TextView user_sex;   
  21.      private  TextView user_age;   
  22.      private  TextView user_location;   
  23.      private  TextView user_verifyinfo;   
  24.      private  Button user_back_btn;   
  25.      private  Button user_dialog_btn;   
  26.      private  Button user_message_btn;   
  27.      private  GridView gridView;   
  28.        
  29.      @Override   
  30.      protected   void  onCreate(Bundle savedInstanceState){   
  31.          super .onCreate(savedInstanceState);   
  32.         setContentView(R.layout.user_info);   
  33.         setUpViews(); //设置view   
  34.         setUpListeners(); //设置listenter   
  35.         asyncImageLoader =  new  AsyncImageLoader();   
  36.         dataHelper =  new  DataHelper(UserInfoActivity. this );   
  37.         weibo =  new  MyWeiboSync();   
  38.         List<UserInfo> userList = dataHelper.GetUserList( false );   
  39.            
  40.         SharedPreferences preferences = getSharedPreferences( "default_user" ,Activity.MODE_PRIVATE);   
  41.         String nick = preferences.getString( "user_default_nick" "" );   
  42.            
  43.          if  (nick !=  "" ) {   
  44.             user = dataHelper.getUserByName(nick,userList);   
  45.         }   
  46.            
  47.         weibo.setAccessTokenKey(user.getToken());   
  48.         weibo.setAccessTokenSecrect(user.getTokenSecret());   
  49.            
  50.          //获取从上一界面传递过来的数据   
  51.         Intent intent = getIntent();   
  52.         name = intent.getStringExtra( "name" );   
  53.         currentNick = intent.getStringExtra( "nick" ); //昵称   
  54.         origtext = intent.getStringExtra( "origtext" );   
  55.         timestamp = intent.getStringExtra( "timestamp" );   
  56.         user_name.setText( "@" +name);   
  57.         user_origtext.setText(origtext);   
  58.         user_time.setText(timestamp);   
  59.            
  60.         handler =  new  UserInfoHandler();   
  61.         thread =  new  UserInfoThread();   
  62.         thread.start(); //开启一个线程获取数据   
  63.     }   
  64.        
  65.      private   void  setUpViews(){   
  66.         user_headicon = (ImageView) findViewById(R.id.user_headicon);   
  67.         user_nick = (TextView) findViewById(R.id.user_nick);   
  68.         user_name = (TextView) findViewById(R.id.user_name);   
  69.         user_origtext = (TextView) findViewById(R.id.user_origtext);   
  70.         user_time = (TextView) findViewById(R.id.user_time);   
  71.         user_sex = (TextView) findViewById(R.id.user_sex);   
  72.         user_age = (TextView) findViewById(R.id.user_age);   
  73.         user_location = (TextView) findViewById(R.id.user_location);   
  74.         user_verifyinfo = (TextView) findViewById(R.id.user_verifyinfo);   
  75.         user_back_btn = (Button) findViewById(R.id.user_back_btn);   
  76.         user_dialog_btn = (Button) findViewById(R.id.user_dialog_btn);   
  77.         user_message_btn = (Button) findViewById(R.id.user_message_btn);   
  78.         gridView = (GridView)findViewById(R.id.user_grid);   
  79.     }   
  80.        
  81.      private   void  setUpListeners(){   
  82.         gridView.setOnItemClickListener( this );   
  83.     }   
  84.        
  85.      class  UserInfoThread  extends  Thread {   
  86.          @Override   
  87.          public   void  run() {   
  88.             returnJsonStr = weibo.getUserInfoByName(weibo.getAccessTokenKey(), weibo.getAccessTokenSecrect(), name);   
  89.              //通知handler处理数据   
  90.             Message msg = handler.obtainMessage();   
  91.             handler.sendMessage(msg);   
  92.         }   
  93.     }   
  94.        
  95.      class  UserInfoHandler  extends  Handler {    
  96.          @Override   
  97.          public   void  handleMessage(Message msg){   
  98.             Drawable cachedImage;   
  99.              try  {   
  100.                 dataObj =  new  JSONObject(returnJsonStr).getJSONObject( "data" );   
  101.                 cachedImage = asyncImageLoader.loadDrawable(dataObj.getString( "head" )+ "/100" ,user_headicon,  new  ImageCallback(){   
  102.                      @Override   
  103.                      public   void  imageLoaded(Drawable imageDrawable,ImageView imageView, String imageUrl) {   
  104.                         imageView.setImageDrawable(imageDrawable);   
  105.                     }   
  106.                 });   
  107.                  if  (cachedImage ==  null ) {   
  108.                     user_headicon.setImageResource(R.drawable.icon);   
  109.                 }  else  {   
  110.                     user_headicon.setImageDrawable(cachedImage);   
  111.                 }   
  112.                 user_nick.setText(dataObj.getString( "nick" ));   
  113.                 user_sex.setText(dataObj.getInt( "sex" )== 1 ? "男" : "女" );   
  114.                  if (dataObj.getInt( "birth_year" )!= 0 ){   
  115.                     user_age.setText((Calendar.getInstance().get(Calendar.YEAR)-dataObj.getInt( "birth_year" ))+ "岁" );   
  116.                 }   
  117.                 user_location.setText(dataObj.getString( "location" ));   
  118.                 String verifyinfo = dataObj.getString( "verifyinfo" );   
  119.                  if (verifyinfo== null || "" .equals(verifyinfo)){   
  120.                     user_verifyinfo.setText( "这家伙很懒,没留什么" );   
  121.                 } else {   
  122.                     user_verifyinfo.setText(verifyinfo);   
  123.                 }   
  124.                  final  List<String> numsList =  new  ArrayList<String>();   
  125.                 numsList.add(dataObj.getString( "tweetnum" ));   
  126.                 numsList.add(dataObj.getString( "fansnum" ));   
  127.                 numsList.add(dataObj.getString( "idolnum" ));   
  128.                 gridView.setAdapter( new  GridAdapter(UserInfoActivity. this , numsList));   
  129.             }  catch  (JSONException e) {   
  130.                 e.printStackTrace();   
  131.             }   
  132.         }   
  133.     }   
  134.        
  135.      class  GridAdapter  extends  BaseAdapter {   
  136.          private  Context context;   
  137.          private  LayoutInflater inflater;   
  138.         List<String> numList;   
  139.            
  140.          public  GridAdapter(Context context, List<String> numList) {   
  141.              super ();   
  142.              this .context = context;   
  143.              this .numList = numList;   
  144.              this .inflater = LayoutInflater.from(context);   
  145.         }   
  146.   
  147.          @Override   
  148.          public   int  getCount() {   
  149.              return  numList.size();   
  150.         }   
  151.   
  152.          @Override   
  153.          public  Object getItem( int  position) {   
  154.              return  numList.get(position);   
  155.         }   
  156.   
  157.          @Override   
  158.          public   long  getItemId( int  position) {   
  159.              return  position;   
  160.         }   
  161.   
  162.          @Override   
  163.          public  View getView( final   int  position, View convertView, ViewGroup parent){   
  164.             convertView = inflater.inflate(R.layout.userinfo_grid_item,  null );   
  165.             TextView num = (TextView)convertView.findViewById(R.id.userinfo_grid_num);   
  166.             TextView title = (TextView)convertView.findViewById(R.id.userinfo_grid_title);   
  167.             ImageView image = (ImageView)convertView.findViewById(R.id.userinfo_grid_image);   
  168.              switch  (position) {   
  169.              case   0 :   
  170.                 num.setText(numList.get( 0 ));   
  171.                 title.setText( "广播" );   
  172.                 image.setVisibility(View.VISIBLE);   
  173.                  break ;   
  174.              case   1 :   
  175.                 num.setText(numList.get( 1 ));   
  176.                 title.setText( "听众" );   
  177.                 image.setVisibility(View.VISIBLE);   
  178.                  break ;   
  179.              case   2 :   
  180.                 num.setText(numList.get( 2 ));   
  181.                 title.setText( "收听" );   
  182.                  break ;   
  183.   
  184.              default :   
  185.                  break ;   
  186.             }   
  187.              return  convertView;   
  188.         }   
  189.     }   
  190.   
  191.      @Override   
  192.      public   void  onItemClick(AdapterView<?> arg0, View arg1,  int  position,  long  arg3){   
  193.          switch  (position) {   
  194.          case   0 :   
  195.             Intent intent =  new  Intent(UserInfoActivity. this ,TweetsActivity. class );   
  196.             intent.putExtra( "name" , name);   
  197.             intent.putExtra( "nick" ,currentNick);   
  198.             startActivity(intent);   
  199.              break ;   
  200.          case   1 :   
  201.             Intent intent2 =  new  Intent(UserInfoActivity. this ,FansActivity. class );   
  202.             intent2.putExtra( "name" , name);   
  203.             intent2.putExtra( "nick" ,currentNick);   
  204.             startActivity(intent2);   
  205.              break ;   
  206.          case   2 :   
  207.             Intent intent3 =  new  Intent(UserInfoActivity. this ,IdolActivity. class );   
  208.             intent3.putExtra( "name" , name);   
  209.             intent3.putExtra( "nick" ,currentNick);   
  210.             startActivity(intent3);   
  211.              break ;   
  212.          default :   
  213.              break ;   
  214.         }   
  215.            
  216.     }   
  217. }  
      public class UserInfoActivity extends Activity implements OnItemClickListener{
	private String currentNick;
	private String name;
	private String origtext;
	private String timestamp;
	private DataHelper dataHelper;
	private UserInfo user;
	private MyWeiboSync weibo;
	private Handler handler;
	private AsyncImageLoader asyncImageLoader; 
	private UserInfoThread thread;
	private String weiboid;
	private String returnJsonStr;
	private JSONObject dataObj ;
	private ImageView user_headicon;
	private TextView user_nick;
	private TextView user_name;
	private TextView user_origtext;
	private TextView user_time;
	private TextView user_sex;
	private TextView user_age;
	private TextView user_location;
	private TextView user_verifyinfo;
	private Button user_back_btn;
	private Button user_dialog_btn;
	private Button user_message_btn;
	private GridView gridView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.user_info);
		setUpViews();//设置view
		setUpListeners();//设置listenter
		asyncImageLoader = new AsyncImageLoader();
		dataHelper = new DataHelper(UserInfoActivity.this);
		weibo = new MyWeiboSync();
		List<UserInfo> userList = dataHelper.GetUserList(false);
		
		SharedPreferences preferences = getSharedPreferences("default_user",Activity.MODE_PRIVATE);
		String nick = preferences.getString("user_default_nick", "");
		
		if (nick != "") {
			user = dataHelper.getUserByName(nick,userList);
		}
		
		weibo.setAccessTokenKey(user.getToken());
		weibo.setAccessTokenSecrect(user.getTokenSecret());
		
		//获取从上一界面传递过来的数据
		Intent intent = getIntent();
		name = intent.getStringExtra("name");
		currentNick = intent.getStringExtra("nick");//昵称
		origtext = intent.getStringExtra("origtext");
		timestamp = intent.getStringExtra("timestamp");
		user_name.setText("@"+name);
		user_origtext.setText(origtext);
		user_time.setText(timestamp);
		
		handler = new UserInfoHandler();
		thread = new UserInfoThread();
		thread.start();//开启一个线程获取数据
	}
	
	private void setUpViews(){
		user_headicon = (ImageView) findViewById(R.id.user_headicon);
		user_nick = (TextView) findViewById(R.id.user_nick);
		user_name = (TextView) findViewById(R.id.user_name);
		user_origtext = (TextView) findViewById(R.id.user_origtext);
		user_time = (TextView) findViewById(R.id.user_time);
		user_sex = (TextView) findViewById(R.id.user_sex);
		user_age = (TextView) findViewById(R.id.user_age);
		user_location = (TextView) findViewById(R.id.user_location);
		user_verifyinfo = (TextView) findViewById(R.id.user_verifyinfo);
		user_back_btn = (Button) findViewById(R.id.user_back_btn);
		user_dialog_btn = (Button) findViewById(R.id.user_dialog_btn);
		user_message_btn = (Button) findViewById(R.id.user_message_btn);
		gridView = (GridView)findViewById(R.id.user_grid);
	}
	
	private void setUpListeners(){
		gridView.setOnItemClickListener(this);
	}
	
	class UserInfoThread extends Thread {
		@Override
		public void run() {
			returnJsonStr = weibo.getUserInfoByName(weibo.getAccessTokenKey(), weibo.getAccessTokenSecrect(), name);
			//通知handler处理数据
			Message msg = handler.obtainMessage();
			handler.sendMessage(msg);
		}
	}
	
	class UserInfoHandler extends Handler { 
		@Override
		public void handleMessage(Message msg){
			Drawable cachedImage;
			try {
				dataObj = new JSONObject(returnJsonStr).getJSONObject("data");
				cachedImage = asyncImageLoader.loadDrawable(dataObj.getString("head")+"/100",user_headicon, new ImageCallback(){
	                @Override
	                public void imageLoaded(Drawable imageDrawable,ImageView imageView, String imageUrl) {
	                    imageView.setImageDrawable(imageDrawable);
	                }
	            });
				if (cachedImage == null) {
					user_headicon.setImageResource(R.drawable.icon);
				} else {
					user_headicon.setImageDrawable(cachedImage);
				}
				user_nick.setText(dataObj.getString("nick"));
				user_sex.setText(dataObj.getInt("sex")==1?"男":"女");
				if(dataObj.getInt("birth_year")!=0){
					user_age.setText((Calendar.getInstance().get(Calendar.YEAR)-dataObj.getInt("birth_year"))+"岁");
				}
				user_location.setText(dataObj.getString("location"));
				String verifyinfo = dataObj.getString("verifyinfo");
				if(verifyinfo==null||"".equals(verifyinfo)){
					user_verifyinfo.setText("这家伙很懒,没留什么");
				}else{
					user_verifyinfo.setText(verifyinfo);
				}
				final List<String> numsList = new ArrayList<String>();
				numsList.add(dataObj.getString("tweetnum"));
				numsList.add(dataObj.getString("fansnum"));
				numsList.add(dataObj.getString("idolnum"));
				gridView.setAdapter(new GridAdapter(UserInfoActivity.this, numsList));
			} catch (JSONException e) {
				e.printStackTrace();
			}
		}
	}
	
	class GridAdapter extends BaseAdapter {
		private Context context;
		private LayoutInflater inflater;
		List<String> numList;
		
		public GridAdapter(Context context, List<String> numList) {
			super();
			this.context = context;
			this.numList = numList;
			this.inflater = LayoutInflater.from(context);
		}

		@Override
		public int getCount() {
			return numList.size();
		}

		@Override
		public Object getItem(int position) {
			return numList.get(position);
		}

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

		@Override
		public View getView(final int position, View convertView, ViewGroup parent){
			convertView = inflater.inflate(R.layout.userinfo_grid_item, null);
			TextView num = (TextView)convertView.findViewById(R.id.userinfo_grid_num);
			TextView title = (TextView)convertView.findViewById(R.id.userinfo_grid_title);
			ImageView image = (ImageView)convertView.findViewById(R.id.userinfo_grid_image);
			switch (position) {
			case 0:
				num.setText(numList.get(0));
				title.setText("广播");
				image.setVisibility(View.VISIBLE);
				break;
			case 1:
				num.setText(numList.get(1));
				title.setText("听众");
				image.setVisibility(View.VISIBLE);
				break;
			case 2:
				num.setText(numList.get(2));
				title.setText("收听");
				break;

			default:
				break;
			}
			return convertView;
		}
	}

	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3){
		switch (position) {
		case 0:
			Intent intent = new Intent(UserInfoActivity.this,TweetsActivity.class);
			intent.putExtra("name", name);
			intent.putExtra("nick",currentNick);
			startActivity(intent);
			break;
		case 1:
			Intent intent2 = new Intent(UserInfoActivity.this,FansActivity.class);
			intent2.putExtra("name", name);
			intent2.putExtra("nick",currentNick);
			startActivity(intent2);
			break;
		case 2:
			Intent intent3 = new Intent(UserInfoActivity.this,IdolActivity.class);
			intent3.putExtra("name", name);
			intent3.putExtra("nick",currentNick);
			startActivity(intent3);
			break;
		default:
			break;
		}
		
	}
}
    


Java代码 复制代码   收藏代码
  1. <?xml version= "1.0"  encoding= "utf-8" ?>   
  2. <RelativeLayout android:layout_width= "fill_parent"  android:layout_height= "fill_parent"  android:background= "#c0c8d0"   
  3.     xmlns:android= "http://schemas.android.com/apk/res/android" >   
  4.     <RelativeLayout android:id= "@+id/user_top"  android:paddingTop= "5.0dip"  android:layout_width= "fill_parent"  android:layout_height= "60.0dip"  android:layout_alignParentTop= "true"  android:layout_centerHorizontal= "true" >   
  5.         <ImageView android:id= "@+id/user_headicon"  android:layout_marginLeft= "8.0dip"  android:layout_width= "45.0dip"  android:layout_height= "45.0dip"  android:layout_alignParentLeft= "true" />   
  6.         <TextView android:id= "@+id/user_nick"  android:layout_marginLeft= "5.0dip"  android:layout_width= "wrap_content"  android:layout_toRightOf= "@id/user_headicon"  android:textColor= "#384050"   
  7.             android:layout_height= "wrap_content" />   
  8.         <TextView android:id= "@+id/user_name"  android:layout_width= "wrap_content"  android:layout_marginLeft= "10.0dip"  android:layout_toRightOf= "@id/user_headicon"  android:textColor= "#687888"   
  9.             android:layout_height= "wrap_content"  android:layout_below= "@id/user_nick" />   
  10.     </RelativeLayout>   
  11.     <LinearLayout android:paddingLeft= "10.0dip"  android:paddingRight= "10.0dip"  android:layout_width= "fill_parent"  android:layout_height= "wrap_content"  android:orientation= "vertical"  android:layout_below= "@id/user_top" >   
  12.         <ImageView android:background= "#a0b0b0"  android:layout_width= "fill_parent"  android:layout_height= "1.0dip"  android:scaleType= "fitCenter" />   
  13.         <RelativeLayout android:layout_width= "fill_parent"  android:layout_height= "wrap_content"  android:layout_marginTop= "10.0dip" >   
  14.             <GridView android:gravity= "center"  android:listSelector= "@drawable/listitem_selector"  android:id= "@+id/user_grid"  android:background= "@drawable/userinfo_grid_bg"  android:layout_width= "fill_parent"  android:layout_height= "wrap_content"  android:numColumns= "3" />   
  15.         </RelativeLayout>   
  16.         <RelativeLayout android:layout_width= "fill_parent"  android:layout_height= "wrap_content"  android:layout_marginTop= "10.0dip"  android:background= "@drawable/panel_bg" >   
  17.             <TextView android:id= "@+id/user_sex"  android:layout_marginLeft= "5.0dip"  android:layout_alignParentLeft= "true"  android:layout_width= "wrap_content"   android:textSize= "12.0sp"  android:textColor= "#788080"   
  18.                 android:layout_height= "wrap_content" />   
  19.             <TextView android:id= "@+id/user_age"  android:layout_toRightOf= "@id/user_sex"  android:layout_width= "wrap_content"   android:textSize= "12.0sp"  android:textColor= "#788080"   
  20.                 android:layout_height= "wrap_content" />   
  21.             <TextView  android:id= "@+id/user_location"  android:layout_toRightOf= "@id/user_age"  android:layout_width= "wrap_content"  android:textSize= "12.0sp"  android:textColor= "#788080"   
  22.                 android:layout_height= "wrap_content" />   
  23.             <TextView  android:id= "@+id/user_verifyinfo"  android:layout_marginLeft= "5.0dip"  android:layout_alignParentLeft= "true"  android:layout_below= "@id/user_sex"  android:layout_width= "fill_parent"  android:textSize= "12.0sp"  android:textColor= "#788080"   
  24.                 android:layout_height= "wrap_content" />   
  25.         </RelativeLayout>   
  26.         <RelativeLayout android:layout_width= "fill_parent"  android:layout_height= "wrap_content"  android:layout_marginTop= "10.0dip"  android:background= "@drawable/panel_bg" >   
  27.             <TextView android:text= "最新广播:"  android:layout_width= "fill_parent"  android:layout_marginLeft= "5.0dip"  android:textSize= "12.0sp"  android:textColor= "#788080"   
  28.                 android:layout_height= "wrap_content" />   
  29.             <TextView android:id= "@+id/user_time"  android:layout_width= "wrap_content"  android:layout_marginLeft= "3.0dip"  android:layout_marginTop= "10.0dip"  android:textSize= "8.0sp"  android:textColor= "#788080"   
  30.                 android:layout_height= "wrap_content"  android:layout_alignParentRight= "true" />   
  31.             <TextView android:id= "@+id/user_origtext"  android:layout_width= "fill_parent"  android:layout_marginLeft= "5.0dip"  android:textSize= "12.0sp"  android:textColor= "#788080"     
  32.                 android:layout_height= "wrap_content"  android:layout_below= "@id/user_time"  android:layout_alignParentLeft= "true" />   
  33.         </RelativeLayout>   
  34.     </LinearLayout>   
  35.     <RelativeLayout android:layout_width= "fill_parent"  android:layout_height= "40.0dip"  android:layout_alignParentBottom= "true" >   
  36.         <Button android:id= "@+id/user_back_btn"  android:layout_width= "40.0dip"  android:drawableTop= "@drawable/btn_back_selector"  android:background= "@drawable/bottom_back_bg"   
  37.             android:layout_height= "40.0dip"   android:layout_alignParentLeft= "true" />   
  38.         <LinearLayout android:id= "@+id/widget41"  android:layout_marginLeft= "60.0dip"  android:layout_alignParentBottom= "true"   
  39.             android:layout_width= "wrap_content"  android:layout_height= "wrap_content"  android:orientation= "horizontal"  android:layout_toRightOf= "@id/user_back_btn" >   
  40.             <ImageView android:background= "#f8f8f8"  android:layout_width= "1.0dip"  android:layout_height= "20.0dip"  android:scaleType= "fitCenter" />   
  41.             <Button android:id= "@+id/user_dialog_btn"  android:layout_width= "wrap_content"  android:background= "@drawable/bottom_bar_bg"   
  42.                 android:layout_height= "wrap_content"  android:text= "对话" />   
  43.             <ImageView android:background= "#f8f8f8"  android:layout_width= "1.0dip"  android:layout_height= "20.0dip"  android:scaleType= "fitCenter" />   
  44.             <Button android:id= "@+id/user_message_btn"  android:layout_width= "wrap_content"  android:background= "@drawable/bottom_bar_bg"   
  45.                 android:layout_height= "wrap_content"  android:text= "点评" />   
  46.         </LinearLayout>   
  47.         <Button android:id= "@+id/user_tohome_btn"  android:layout_width= "40.0dip"   
  48.             android:layout_height= "40.0dip"  android:drawableTop= "@drawable/btn_home_selector"  android:background= "@drawable/bottom_home_bg"  android:layout_alignParentRight= "true" />   
  49.     </RelativeLayout>   
  50. </RelativeLayout>  
      <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#c0c8d0"
	xmlns:android="http://schemas.android.com/apk/res/android">
	<RelativeLayout android:id="@+id/user_top" android:paddingTop="5.0dip" android:layout_width="fill_parent" android:layout_height="60.0dip" android:layout_alignParentTop="true" android:layout_centerHorizontal="true">
		<ImageView android:id="@+id/user_headicon" android:layout_marginLeft="8.0dip" android:layout_width="45.0dip" android:layout_height="45.0dip" android:layout_alignParentLeft="true"/>
		<TextView android:id="@+id/user_nick" android:layout_marginLeft="5.0dip" android:layout_width="wrap_content" android:layout_toRightOf="@id/user_headicon" android:textColor="#384050"
			android:layout_height="wrap_content"/>
		<TextView android:id="@+id/user_name" android:layout_width="wrap_content" android:layout_marginLeft="10.0dip" android:layout_toRightOf="@id/user_headicon" android:textColor="#687888"
			android:layout_height="wrap_content" android:layout_below="@id/user_nick"/>
	</RelativeLayout>
	<LinearLayout android:paddingLeft="10.0dip" android:paddingRight="10.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_below="@id/user_top">
		<ImageView android:background="#a0b0b0" android:layout_width="fill_parent" android:layout_height="1.0dip" android:scaleType="fitCenter"/>
		<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10.0dip">
			<GridView android:gravity="center" android:listSelector="@drawable/listitem_selector" android:id="@+id/user_grid" android:background="@drawable/userinfo_grid_bg" android:layout_width="fill_parent" android:layout_height="wrap_content" android:numColumns="3"/>
		</RelativeLayout>
		<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10.0dip" android:background="@drawable/panel_bg">
			<TextView android:id="@+id/user_sex" android:layout_marginLeft="5.0dip" android:layout_alignParentLeft="true" android:layout_width="wrap_content"  android:textSize="12.0sp" android:textColor="#788080"
				android:layout_height="wrap_content"/>
			<TextView android:id="@+id/user_age" android:layout_toRightOf="@id/user_sex" android:layout_width="wrap_content"  android:textSize="12.0sp" android:textColor="#788080"
				android:layout_height="wrap_content"/>
			<TextView  android:id="@+id/user_location" android:layout_toRightOf="@id/user_age" android:layout_width="wrap_content" android:textSize="12.0sp" android:textColor="#788080"
				android:layout_height="wrap_content"/>
			<TextView  android:id="@+id/user_verifyinfo" android:layout_marginLeft="5.0dip" android:layout_alignParentLeft="true" android:layout_below="@id/user_sex" android:layout_width="fill_parent" android:textSize="12.0sp" android:textColor="#788080"
				android:layout_height="wrap_content"/>
		</RelativeLayout>
		<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10.0dip" android:background="@drawable/panel_bg">
			<TextView android:text="最新广播:" android:layout_width="fill_parent" android:layout_marginLeft="5.0dip" android:textSize="12.0sp" android:textColor="#788080"
				android:layout_height="wrap_content"/>
			<TextView android:id="@+id/user_time" android:layout_width="wrap_content" android:layout_marginLeft="3.0dip" android:layout_marginTop="10.0dip" android:textSize="8.0sp" android:textColor="#788080"
				android:layout_height="wrap_content" android:layout_alignParentRight="true"/>
			<TextView android:id="@+id/user_origtext" android:layout_width="fill_parent" android:layout_marginLeft="5.0dip" android:textSize="12.0sp" android:textColor="#788080" 
				android:layout_height="wrap_content" android:layout_below="@id/user_time" android:layout_alignParentLeft="true"/>
		</RelativeLayout>
	</LinearLayout>
	<RelativeLayout android:layout_width="fill_parent" android:layout_height="40.0dip" android:layout_alignParentBottom="true">
		<Button android:id="@+id/user_back_btn" android:layout_width="40.0dip" android:drawableTop="@drawable/btn_back_selector" android:background="@drawable/bottom_back_bg"
			android:layout_height="40.0dip"  android:layout_alignParentLeft="true"/>
		<LinearLayout android:id="@+id/widget41" android:layout_marginLeft="60.0dip" android:layout_alignParentBottom="true"
			android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_toRightOf="@id/user_back_btn">
			<ImageView android:background="#f8f8f8" android:layout_width="1.0dip" android:layout_height="20.0dip" android:scaleType="fitCenter"/>
			<Button android:id="@+id/user_dialog_btn" android:layout_width="wrap_content" android:background="@drawable/bottom_bar_bg"
				android:layout_height="wrap_content" android:text="对话"/>
			<ImageView android:background="#f8f8f8" android:layout_width="1.0dip" android:layout_height="20.0dip" android:scaleType="fitCenter"/>
			<Button android:id="@+id/user_message_btn" android:layout_width="wrap_content" android:background="@drawable/bottom_bar_bg"
				android:layout_height="wrap_content" android:text="点评"/>
		</LinearLayout>
		<Button android:id="@+id/user_tohome_btn" android:layout_width="40.0dip"
			android:layout_height="40.0dip" android:drawableTop="@drawable/btn_home_selector" android:background="@drawable/bottom_home_bg" android:layout_alignParentRight="true"/>
	</RelativeLayout>
</RelativeLayout>

    


Java代码 复制代码   收藏代码
  1. <?xml version= "1.0"  encoding= "utf-8" ?>   
  2. <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android"  android:gravity= "center"  android:paddingTop= "3.0dip"  android:orientation= "horizontal"  android:layout_width= "wrap_content"  android:layout_height= "wrap_content" >   
  3.     <LinearLayout android:orientation= "vertical"  android:layout_width= "wrap_content"  android:layout_height= "wrap_content" >   
  4.         <TextView android:id= "@+id/userinfo_grid_num"  android:layout_width= "wrap_content"  android:layout_height= "wrap_content"  android:textColor= "#586068" />   
  5.         <TextView android:id= "@+id/userinfo_grid_title"  android:layout_width= "wrap_content"  android:layout_height= "wrap_content"  android:textColor= "#98a0a0" />   
  6.     </LinearLayout>   
  7.     <ImageView android:id= "@+id/userinfo_grid_image"  android:src= "#d0d0d8"  android:visibility= "invisible"  android:layout_width= "1.0dip"  android:layout_height= "30.0dip"  android:layout_marginLeft= "30.0dip" />   
  8. </LinearLayout>  
  9. http://helloandroid.iteye.com/blog/1136746

(转摘)Android腾讯微薄客户端开发九:博主详情界面篇(广播,听众,收听)


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论