中心向右对齐效果


想做出下图中球员列表的数字靠右对齐的效果,但。。。菜鸟无能。。。



下图是目前做出的效果,左边数字可以向右对齐,但不知道为什么右边的数字对不起。

我想做出数字垂直中心对齐,而不是整齐向右对齐。。。

这个难题,留着,以后解决


布局文件代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

  
    
	    <LinearLayout
	        android:layout_width="0dp"
	    	android:layout_height="wrap_content"
	    	android:layout_weight="1"
	    	android:orientation="horizontal">
	    	
	    	<ImageView
		        android:id="@+id/img1"
		        android:layout_width="0dp"
		    	android:layout_height="wrap_content"
		    	android:layout_weight="1"/>
	    	
	    	<TextView
		        android:id="@+id/mem1"
		        android:layout_width="wrap_content"
		    	android:layout_height="wrap_content"
		    	android:layout_weight="4"/>
	    	
	    	<TextView
		        android:id="@+id/sco1"
		        android:layout_width="wrap_content"
		    	android:layout_height="wrap_content"
		    	android:gravity="right"
		    	android:layout_weight="1"/>
	    	
	    </LinearLayout>
	    
	    <LinearLayout
	        android:layout_width="0dp"
	    	android:layout_height="wrap_content"
	    	android:layout_weight="1"
	    	android:orientation="horizontal">
	    	
	    	
	    	<ImageView
		        android:id="@+id/img2"
		        android:layout_width="0dp"
		    	android:layout_height="wrap_content"
		    	android:layout_weight="1"/>
	    	
	    	<TextView
		        android:id="@+id/mem2"
		        android:layout_width="wrap_content"
		    	android:layout_height="wrap_content"
		    	android:layout_weight="4"/>
	    	
	    	<TextView
		        android:id="@+id/sco2"
		        android:layout_width="wrap_content"
		    	android:layout_height="wrap_content"
		    	android:layout_weight="1"/>
	    	
	    </LinearLayout>
	    



</LinearLayout>

java代码

View view = LayoutInflater.from(context).inflate(R.layout.dialog_item_item,parent,false);
			
		    ImageView ivImg1=(ImageView)view.findViewById(R.id.img1);
		    ivImg1.setImageResource(img[position*2]);
		    ImageView ivImg2=(ImageView)view.findViewById(R.id.img2);
		    ivImg2.setImageResource(img[position*2+1]);
			
			TextView tvMen1=(TextView)view.findViewById(R.id.mem1);
			tvMen1.setText(memberName[countryNum][position*2]);
			//tvMen1.setTextSize(18);
			TextView tvMen2=(TextView)view.findViewById(R.id.mem2);
			tvMen2.setText(memberName[countryNum][position*2+1]);
			//tvMen2.setTextSize(18);
			
			TextView tvSco1=(TextView)view.findViewById(R.id.sco1);
			tvSco1.setText(sco[position*2]+"");
			tvSco1.setPadding(0, 0, 5, 0);
			//tvSco1.setTextSize(18);
			
			TextView tvSco2=(TextView)view.findViewById(R.id.sco2);
			tvSco2.setText(sco[position*2+1]+"");
			//tvSco2.setTextSize(18);
            
			return view;



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值