2011-01-04 10 views
0

.xmlファイルでどのようにレイアウトを使用できますか。 Tablelayoutを使用したいので、XMLファイルのグラフィカルレイアウトにドラッグして、そのレイアウトを2列にしたいとします(最初の列に "Name:"を、別の列に "EditText"を追加したい場合)。 )私はそれを行うanableです。私はグラフィカルなレイアウトを使用しています。私はそうしたい.xmlファイルでレイアウトを使用する方法:Androidアプリケーション

 
Name : EditText (A textbox for Name entry) 
Age : EditText (A textbox for Age entry) 

       Button (to save user entry) 

どのようにそれを設計する。

+0

私は常にXMLビューに行くのが容易に見つけます手で欲しいものを入力してください。レイアウトのドラッグ&ドロップ設計は、私が望むように動作することはめったにありません。 – ehudokai

答えて

0
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:isScrollContainer="true" 
> 

    <EditText 
     android:id="@+id/et_name" 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent" 

     android:visibility="visible" 
     android:maxLines="1" 
     android:nextFocusDown="@+id/mark"/> 

    <EditText 
     android:id="@+id/et_age" 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent" 
     android:inputType="numberDecimal" 

     android:visibility="visible" 
     android:maxLength="3" 
     android:maxLines="1"/> 

    <Button 
     android:id="@+id/btn_save" 
     android:text="@string/save" 
     android:layout_width="fill_parent" 
     android:onClick="onButtonClick" 
     android:layout_height="wrap_content" 
     android:enabled="false" /> 

</LinearLayout> 

あなたが行くあり、あなたのXML にこれを入れ;)

0

私は去ることと同じであると考えます。おおまかにXMLに精通している場合は、グラフィカルレイアウトを使用して、すべてが正常に機能しているかどうかを制御してください。 XMLで必要なものを作成する方法がわからない場合は、どこかにドラッグして&のコードを適切な位置に貼り付けてください。 私は、グラフィカルなレイアウトはプロパティを編集するのにはかなり良いと思うので、あなたが何を変えているのかを直接見ることができます。

+0

私はグラフィカルレイアウトを使用しています.... –

関連する問題