zoukankan      html  css  js  c++  java
  • RadioGroup 小例子

    效果图:


    代码:
    <?xml version="1.0" encoding="utf-8"?>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:layout_above="@+id/navigationBar" android:layout_marginBottom="-12dp">

    <FrameLayout
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:id="@+id/fragment_recommend" />

    <FrameLayout
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:id="@+id/fragment_find_lesson" />

    <FrameLayout
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:id="@+id/fragment_offline_learning" />

    <FrameLayout
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:id="@+id/fragment_personal_center" />
    </FrameLayout>

    <RadioGroup
    android:id="@+id/navigationBar" android:orientation="horizontal" android:layout_width="match_parent"
    android:layout_height="65dp" android:background="@drawable/home_navigation_bg"
    android:layout_alignParentBottom="true">

    <RadioButton
    style="@style/Home_NavigationBar" android:checked="true" android:text="@string/recommend"
    android:id="@+id/btn_recommend" android:drawableTop="@drawable/recommend_btn_press" />

    <RadioButton
    style="@style/Home_NavigationBar" android:text="@string/find_lesson" android:id="@+id/btn_findcourse"
    android:drawableTop="@drawable/findcourse_btn_press" />

    <ImageButton
    android:id="@+id/home_play_btn" android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:src="@drawable/home_play" android:background="@null" android:layout_gravity="center" />

    <RadioButton
    style="@style/Home_NavigationBar" android:text="@string/offline_learning"
    android:id="@+id/btn_offlinelearning" android:drawableTop="@drawable/offline_btn_press" />

    <RadioButton
    style="@style/Home_NavigationBar" android:text="@string/mine" android:id="@+id/btn_personcenter"
    android:drawableTop="@drawable/me_btn_press" />
    </RadioGroup>

    </RelativeLayout>
    style.xml:
    <style name="Home_NavigationBar">
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_width">0dp</item>
    <item name="android:layout_weight">1</item>
    <item name="android:singleLine">true</item>
    <item name="android:button">@null</item>
    <item name="android:background">@color/transparent</item>
    <item name="android:gravity">center</item>
    <item name="android:layout_gravity">bottom</item>
    <item name="android:textColor">@drawable/home_button_text_color_selector</item>
    <item name="android:textSize">@dimen/textsize_26px</item>
    <item name="android:drawablePadding">2dp</item>
    </style>
    @drawable/home_button_text_color_selector.xml
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_selected="true" android:color="@color/black"/>
    <item android:state_selected="false" android:color="#888888"/>
    </selector>

    效果图:

    代码:
    <LinearLayout
    android:id="@+id/video_audio_title" android:layout_width="match_parent"
    android:layout_height="wrap_content" android:background="@color/video_audio_title_bg"
    android:orientation="vertical">

    <RadioGroup
    android:id="@+id/download_title" android:layout_width="match_parent"
    android:layout_height="@dimen/offline_downloaded_bg_height"
    android:background="@color/offline_downloaded_title_bg" android:gravity="center_vertical"
    android:orientation="horizontal">

    <RadioButton
    android:id="@+id/download_audio_title" android:layout_width="0dp" android:layout_height="wrap_content"
    android:layout_weight="1" android:button="@null"
    android:drawableLeft="@drawable/offline_downloaded_audio_img"
    android:drawablePadding="@dimen/offline_downloaded_title_pic"
    android:paddingLeft="@dimen/offline_downloaded_title_left"
    android:text="@string/audio" android:textColor="@color/frag_download_video_tab_txtclr"
    android:textSize="@dimen/offline_downloaded_title_text"/>

    <RadioButton
    android:id="@+id/download_video_title" android:layout_width="0dp" android:layout_height="wrap_content"
    android:layout_weight="1"
    android:button="@null" android:checked="true"
    android:drawableLeft="@drawable/offline_downloaded_video_img"
    android:drawablePadding="@dimen/offline_downloaded_title_pic"
    android:paddingLeft="@dimen/offline_downloaded_title_left"
    android:text="@string/video" android:textColor="@color/frag_download_video_tab_txtclr"
    android:textSize="@dimen/offline_downloaded_title_text"/>
    </RadioGroup>

    <ImageView
    android:id="@+id/cursor" android:layout_width="@dimen/offline_downloaded_cursor_height"
    android:layout_height="@dimen/offline_downloaded_cursor_height"
    android:background="@color/offline_downloaded_cursor_color"/>
    </LinearLayout>



  • 相关阅读:
    为Mac Terminal设置代理
    Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo
    vue.js环境搭建
    nodejs实现的简单接口
    Runtime
    iOS -- 神战
    前端视频
    iOS-- 重要的链接
    Oracle 11g R2安装手册(图文教程)For Windows
    undo_retention:确定最优的撤销保留时间
  • 原文地址:https://www.cnblogs.com/niuxx-android/p/5420743.html
Copyright © 2011-2022 走看看