最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android編程實(shí)現(xiàn)變化的雙重選擇框功能示例

 更新時(shí)間:2017年10月27日 10:46:22   作者:GISuuser  
這篇文章主要介紹了Android編程實(shí)現(xiàn)變化的雙重選擇框功能,結(jié)合實(shí)例形式分析了Android雙重選擇框功能的樣式布局與功能實(shí)現(xiàn)技巧,需要的朋友可以參考下

本文實(shí)例講述了Android編程實(shí)現(xiàn)變化的雙重選擇框功能。分享給大家供大家參考,具體如下:

原理:定義四個(gè)RadioGroup,通過第一個(gè)RadioGroup的選擇來控制其余幾個(gè)radiogroup的顯隱

布局:

<?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="vertical"
  android:padding="20dp">
  <TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="請選擇圖層"
    android:textColor="@color/green"
    android:textSize="@dimen/text"/>
  <RadioGroup
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/radiogroup1">
    <RadioButton
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="永順鎮(zhèn)規(guī)劃圖"
      android:id="@+id/radi1"
      android:checked="true"
      />
    <RadioButton
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="永順鎮(zhèn)權(quán)屬"
      android:id="@+id/radi2"/>
    <RadioButton
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="永順鎮(zhèn)現(xiàn)狀"
      android:id="@+id/radi3"/>
  </RadioGroup>
  <TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="選擇查詢字段"
    android:textColor="@color/green"
    android:textSize="@dimen/text"/>
  <RadioGroup
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/radiogroup2">
    <RadioButton
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="地塊編號"
      android:id="@+id/a1"
      android:checked="true"/>
    <RadioButton
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="用地性質(zhì)"
      android:id="@+id/a2"/>
    <RadioButton
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="用地分類"
      android:id="@+id/a3"/>
  </RadioGroup>
  <RadioGroup
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/radiogroup3"
    android:visibility="gone">
    <RadioButton
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="權(quán)屬性質(zhì)"
      android:id="@+id/b1"
      android:checked="true"/>
  </RadioGroup>
  <RadioGroup
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/radiogroup4"
    android:visibility="gone">
    <RadioButton
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="用地類別"
      android:id="@+id/c1"
      android:checked="true"/>
    <RadioButton
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="地類號"
      android:id="@+id/c2"/>
    <RadioButton
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="圖斑號"
      android:id="@+id/c3"/>
  </RadioGroup>
  <AutoCompleteTextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="請輸入查詢內(nèi)容"
    android:id="@+id/autoCompleteTextView" />
</LinearLayout>

java代碼:

LayoutInflater layoutInflater=LayoutInflater.from(MainPlan.this);
View self=layoutInflater.inflate(R.layout.thiswindow, null);
final RadioGroup radioGroup1 = (RadioGroup) self.findViewById(R.id.radiogroup1);
final RadioGroup radioGroup2 = (RadioGroup) self.findViewById(R.id.radiogroup2);
final RadioGroup radioGroup3 = (RadioGroup) self.findViewById(R.id.radiogroup3);
final RadioGroup radioGroup4 = (RadioGroup) self.findViewById(R.id.radiogroup4);
radioGroup1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
  @Override
  public void onCheckedChanged(RadioGroup group, int checkedId) {
   switch (checkedId){
     case R.id.radi1:
       radioGroup2.setVisibility(View.VISIBLE);
       radioGroup3.setVisibility(View.GONE);
       radioGroup4.setVisibility(View.GONE);
       break;
     case R.id.radi2:
       radioGroup2.setVisibility(View.GONE);
       radioGroup3.setVisibility(View.VISIBLE);
       radioGroup4.setVisibility(View.GONE);break;
     case R.id.radi3:
       radioGroup2.setVisibility(View.GONE);
       radioGroup3.setVisibility(View.GONE);
       radioGroup4.setVisibility(View.VISIBLE);break;
     default:break;
   }
  }
});

效果圖:

 

更多關(guān)于Android相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android開發(fā)入門與進(jìn)階教程》、《Android調(diào)試技巧與常見問題解決方法匯總》、《Android基本組件用法總結(jié)》、《Android視圖View技巧總結(jié)》、《Android布局layout技巧總結(jié)》及《Android控件用法總結(jié)

希望本文所述對大家Android程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • Android簡單實(shí)現(xiàn)啟動(dòng)畫面的方法

    Android簡單實(shí)現(xiàn)啟動(dòng)畫面的方法

    這篇文章主要介紹了Android簡單實(shí)現(xiàn)啟動(dòng)畫面的方法,結(jié)合實(shí)例形式分析了啟動(dòng)畫面核心代碼及相關(guān)函數(shù),具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2016-07-07
  • Android中Snackbar的使用方法及小技巧

    Android中Snackbar的使用方法及小技巧

    這篇文章主要給大家介紹了關(guān)于Android中Snackbar的使用方法及小技巧的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧。
    2018-03-03
  • Android編程之圖片相關(guān)代碼集錦

    Android編程之圖片相關(guān)代碼集錦

    這篇文章主要介紹了Android編程之圖片相關(guān)代碼集錦,實(shí)例總結(jié)了大量Android圖片操作相關(guān)代碼,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-11-11
  • Android 實(shí)現(xiàn)圓圈擴(kuò)散水波動(dòng)畫效果兩種方法

    Android 實(shí)現(xiàn)圓圈擴(kuò)散水波動(dòng)畫效果兩種方法

    這篇文章主要介紹了Android 實(shí)現(xiàn)圓圈擴(kuò)散水波動(dòng)畫效果兩種方法,需要的朋友可以參考下
    2018-05-05
  • 通過源碼角度看看AccessibilityService

    通過源碼角度看看AccessibilityService

    這篇文章主要給大家介紹了關(guān)于通過源碼角度看看AccessibilityService的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-06-06
  • android如何改變editText控件中部分文字的格式

    android如何改變editText控件中部分文字的格式

    本文主要介紹了android改變editText控件中部分文字格式的方法,具有很好的參考價(jià)值。下面跟著小編一起來看下吧
    2017-03-03
  • Android實(shí)現(xiàn)文字翻轉(zhuǎn)動(dòng)畫的效果

    Android實(shí)現(xiàn)文字翻轉(zhuǎn)動(dòng)畫的效果

    本文實(shí)現(xiàn)了Android程序文字翻轉(zhuǎn)動(dòng)畫的實(shí)現(xiàn),具有一定的參考價(jià)值,有需要的朋友可以了解一下。
    2016-10-10
  • Android 自定義View 密碼框?qū)嵗a

    Android 自定義View 密碼框?qū)嵗a

    這篇文章主要介紹了Android 自定義View 密碼框?qū)嵗a的相關(guān)資料,非常不錯(cuò)具有參考借鑒價(jià)值,需要的朋友可以參考下
    2016-06-06
  • Android版音樂播放器

    Android版音樂播放器

    這篇文章主要為大家詳細(xì)介紹了Android版音樂播放器的實(shí)現(xiàn)方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-05-05
  • Android基于OpenCV實(shí)現(xiàn)Harris角點(diǎn)檢測

    Android基于OpenCV實(shí)現(xiàn)Harris角點(diǎn)檢測

    角點(diǎn)就是極值點(diǎn),即在某方面屬性特別突出的點(diǎn)。當(dāng)然,你可以自己定義角點(diǎn)的屬性(設(shè)置特定熵值進(jìn)行角點(diǎn)檢測)。角點(diǎn)可以是兩條線的交叉處,也可以是位于相鄰的兩個(gè)主要方向不同的事物上的點(diǎn)。本文介紹如何基于OpenCV實(shí)現(xiàn)Harris角點(diǎn)檢測
    2021-06-06

最新評論

榆中县| 洞口县| 应城市| 镇平县| 西丰县| 固镇县| 伊宁县| 营山县| 凯里市| 高台县| 牙克石市| 临桂县| 和硕县| 垦利县| 金沙县| 九龙坡区| 香河县| 河西区| 鄂伦春自治旗| 泊头市| 高安市| 泰州市| 兴和县| 大同县| 四子王旗| 咸宁市| 泰州市| 和静县| 仙桃市| 宝山区| 楚雄市| 彭州市| 新干县| 辽阳县| 吴堡县| 通化市| 镇巴县| 凭祥市| 收藏| 阿坝县| 深泽县|