2012-02-03 9 views
0

私は線形レイアウトでtextviewとedittextを持っています。私が見つけることができる親のパーセンテージとして幅を設定するためにウェイトを使用するすべての例を見たやり方では、どちらのビューも全く表示されません。Androidの重量が作動しない

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
<TextView 
    android:id="@+id/custLabel" 
    android:layout_height="wrap_content" 
    android:layout_weight=".35" 
    android:layout_width="0dip" 
    android:text="Name"/> 
<EditText 
    android:id="@+id/customer" 
    android:layout_height="wrap_content" 
    android:layout_weight=".65" 
    android:layout_width="0dip"/> 
</LinearLayout> 
+0

私はビジュアルスタジオでモノドロイドを使用しています。デバイスに直接デバッグする。 – jmease

+0

'LinearLayout'は垂直方向です。 'TextView'と' EditText'の 'layout_width'を' 'wrap_content''と' layout_height'を '0dp'に設定してください。あなたはそれを間違った方法でやっています。 – Squonk

+0

@MisterSquonk私はいくつかの熟練者よりも断食をしたのは初めてです:-) – Gangnus

答えて

2

レイアウトの向きを変更します。あなたはそれを縦にして、そこに物を入れ、幅を重み付けします!

+0

3日前、間違ったLinearLayoutオリエンテーションのために私は3時間を無駄にしました:-) – Gangnus

+0

それはそれでした。 4分で受け入れます。ありがとう! – jmease

関連する問題