私は2つのEditTextを含むスタイルダイアログでアクティビティを持っています。しかし、私はアプリを実行すると、最初のものだけが表示されます。ここに私のコードは次のとおりです。ダイアログショーを作成するにはXMLだけを使用してすべてのテキストフィールドを表示しますか?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip" >
<EditText
android:id="@+id/firstEditText"
android:layout_height="wrap_content"
android:lines="1"
android:inputType="number"
android:scrollHorizontally="false"
android:layout_width="fill_parent"/>
<EditText
android:id="@+id/secondEditText"
android:layout_height="wrap_content"
android:lines="3"
android:scrollHorizontally="false"
android:layout_width="fill_parent"/>
</LinearLayout>
私の知る限りでは、これは通常のAndroidの動作ですが、どのように私は活動がJavaコードを書くだけでXMLを使用せずに両方のフィールドを表示することができますか?
あなたはあなたのためにそれは多分役に立ち特定のコンポーネントにandroid:visibility="gone"
を属性を使用することができます。この場合
あなたのコードの代わりにこれを試してみてください。 – user1301428