普通网友 2015-01-25 13:18 采纳率: 15.8%
浏览 2774

动态的使用Fragment,底部四个按钮的布局怎么写

原文链接http://blog.csdn.net/lmj623565791/article/details/37970961
我是这样写的但是选中底部的按钮后无效果
<?xml version="1.0" encoding="utf-8"?>
android:baselineAligned="false"
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:id="@+id/tab_bottom_weixin"
    >  
    <Button   
        android:layout_width="wrap_content"  
        android:layout_height="wrap_content"
        android:text="@string/button1"
        android:onClick="onClick"
       >
        </Button>
</LinearLayout>

<LinearLayout 
    android:layout_width="0dp"  
    android:layout_height="wrap_content"  
    android:layout_weight="1" 
    android:id="@+id/tab_bottom_friend">  
    <Button           
        android:layout_width="wrap_content"  
        android:layout_height="wrap_content"
        android:text="@string/button2"
        android:onClick="onClick">
        </Button>
</LinearLayout>

    <LinearLayout 
    android:layout_width="0dp"  
    android:layout_height="wrap_content"  
    android:layout_weight="1" 
    >  
    <Button           
        android:layout_width="wrap_content"  
        android:layout_height="wrap_content"
       android:text="@string/button3">
        </Button>
</LinearLayout>
<LinearLayout 
    android:layout_width="0dp"  
    android:layout_height="wrap_content"  
    android:layout_weight="1" 
    >  
    <Button           
        android:layout_width="wrap_content"  
        android:layout_height="wrap_content"
        android:text="@string/button4">
        </Button>
</LinearLayout>
<android.support.v4.view.ViewPager
    android:id="@+id/vPager"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_weight="1.0"
    android:background="#000000"
    android:flipInterval="30"
    android:persistentDrawingCache="animation" />

  • 写回答

2条回答 默认 最新

  • danielinbiti 2015-01-25 13:26
    关注

    定义一个RadioGroup就可以了。

    评论

报告相同问题?

悬赏问题

  • ¥20 Python安装cvxpy库出问题
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
  • ¥15 python天天向上类似问题,但没有清零
  • ¥30 3天&7天&&15天&销量如何统计同一行
  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 C#调用python代码(python带有库)
  • ¥15 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
  • ¥15 活动选择题。最多可以参加几个项目?
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题