This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- visibility="gone"を指定すれば単に非表示になるだけでなく、あたかも存在しないかのように扱われる --> | |
<TextView | |
android:id="@+id/hidden_parameter" | |
android:visibility="gone" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" /> |
ポイントはandroid:visibility="gone"の指定です。この指定によって、TextViewは単に非表示になるだけでなく、レイアウト上、あたかも存在しないかのように扱われます。しかし、値を保持する箱としては使えますので、疑似hiddenのように扱うことができます。
このTextViewへの値の取得、設定は下記のようになります(一例)。
このTextViewへの値の取得、設定は下記のようになります(一例)。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TextView hidden = (TextView)findViewById(R.id.hidden_parameter); | |
// 値の取得 | |
String value = hidden.getText(); | |
// 値の設定 | |
hidden.setText("Some Value"); |
0 件のコメント:
コメントを投稿