кнопка не отображается в honeyconb - PullRequest
0 голосов
/ 08 декабря 2011

Это мой пользовательский диалог "Смена пароля"

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"  android:orientation="vertical">

    <TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="5dp" android:stretchColumns="1">

        <TableRow android:layout_width="fill_parent">
            <TextView android:text="Old Password " android:id="@+id/textViewOldPwd"
                android:isScrollContainer="true" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:textSize="10dp" 
                android:gravity="right" android:layout_marginRight="5dp" />
            <EditText android:text="" android:id="@+id/editTextOPwd" android:singleLine="true" 
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:password="true" />
        </TableRow>

        <TableRow android:layout_width="fill_parent">
            <TextView android:text="New Password " android:id="@+id/textView0"
                android:isScrollContainer="true" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:textSize="10dp"
                android:gravity="right" android:layout_marginRight="5dp" />
            <EditText android:text="" android:id="@+id/editTextNPwd" android:singleLine="true" 
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:password="true" />
        </TableRow>

        <TableRow android:layout_width="fill_parent">
            <TextView android:text="Confirmation " android:id="@+id/textView1"
                android:isScrollContainer="true" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:textSize="10dp"
                android:gravity="right" android:layout_marginRight="5dp" />
            <EditText android:text="" android:id="@+id/editTextCPwd" android:singleLine="true" 
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:password="true" />
        </TableRow>

    </TableLayout>

    <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" >
            <Button android:text="Change Password" android:layout_width="fill_parent" android:id="@+id/btnChangePwd"
                android:layout_height="wrap_content" android:layout_weight=".50" />
            <Button android:text="Cancel" android:layout_width="fill_parent" android:id="@+id/btnCancelPwd"
                android:layout_height="wrap_content" android:layout_weight=".50" />
    </LinearLayout>

</LinearLayout>

Последние две кнопки btnChangePwd и btnCancelPwd отображаются правильно в wildfire (android 2.2), но не на вкладке galay (android 3.1).это просто пустое место.

другие части кода:

final Dialog dialog = new Dialog(this, R.style.FullHeightDialog);
final View passwordDialog = LayoutInflater.from(this).inflate(R.layout.newpassword, null);
dialog.setContentView(passwordDialog);


<resources>
    <style name="FullHeightDialog" parent="android:style/Theme.Dialog">
        <item name="android:windowNoTitle">true</item>
    </style>
</resources>

1 Ответ

1 голос
/ 08 декабря 2011

Реально, я думаю, что это ошибка в 2.2.Wildfire, потому что, как указано в xml, эти кнопки никогда не должны отображаться.Строка проблемы:

<TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="5dp" android:stretchColumns="1">

См. Часть о layout_height?Это означает, что это заполнит родительский элемент, а кнопки, которые последуют, будут смещены с экрана.В эмуляторе это именно то, что происходит независимо от того, какую версию я использую.Изменив это на wrap_content, вы увидите кнопки.

...