0
我真的不知道這是怎麼回事。按鈕在文本和可見的上方文本下不可見
在我DialogFragment我可以很方便地佈局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<!--<ImageView-->
<!--android:id="@+id/screen_how_to_win"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:background="@drawable/screen_shot_info"-->
<!--android:visibility="gone" />-->
<TextView
android:id="@+id/dialog_text_lost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:gravity="center"
android:text="@string/you_lost"
android:textColor="@android:color/holo_red_dark"
android:textSize="32sp" />
<Button
android:id="@+id/btn_try_again"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/try_again" />
<Button
android:id="@+id/btn_show_me_how_to_win"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/show_me_how_to_win" />
</LinearLayout>
像你看到的,沒有什麼specjal。但是,如果我的按鈕是在TextView下我沒有看到它們,但是當我將按鈕放在我的TextView上時,然後我看到它們。 WTF?我整個眨了眨眼睛。
這裏是我的片段:
public class LostDialogFragment extends DialogFragment {
// @BindView(R.id.btn_show_me_how_to_win)
// Button btnHowWin;
// @BindView(R.id.screen_how_to_win)
// ImageView screenWin;
// @BindView(R.id.btn_try_again)
// Button tryAgain;
// @BindView(R.id.dialog_text_lost)
// TextView textLost;
public LostDialogFragment() {
}
public static LostDialogFragment newInstance(int num) {
LostDialogFragment f = new LostDialogFragment();
Bundle args = new Bundle();
args.putInt("num", num);
f.setArguments(args);
return f;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.lost_dialog_fragment, container, false);
ButterKnife.bind(this, view);
// this.getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
// configureShowMeHowToWinInfo();
return view;
}
// @OnClick({R.id.screen_how_to_win, R.id.btn_try_again})
// public void dismissDialogLostFragment() {
// this.dismiss();
// ((CurrencySelectActivity) getContext()).closerGameFragment();
// }
}
問題是什麼? –