gpt4 book ai didi

android layout-land 和 layout-port 问题

转载 作者:搜寻专家 更新时间:2023-11-01 09:05:19 26 4
gpt4 key购买 nike

我有 layout 文件夹,其中包含纵向布局和 layout-land 文件夹,其中包含横向布局。
现在是这样的情况:我以纵向方向启动应用程序 - 好的,正确的布局,改变方向 - 好的,横向布局,再次改变方向 - 并且..方向改变但布局是横向的..
这是什么?

已编辑:
代码:

private TextView mTxtGoDate;
private TextView mTxtGoBackDate;
private TextView mTxtCityFrom;
private TextView mTxtCityWhere;

private TextView mTxtManCount;
private TextView mTxtChildCount;
private TextView mTxtBabyCount;
private TextView mTxtClass;

private CheckBox mCheckOneWay;
private CheckBox mCheckRange;

private RelativeLayout mLayoutGoBack;

private Button mBtnSearch;

private SearchParams mSearchParams;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_new_search);

mSearchParams = new SearchParams();

mTxtGoDate = (TextView) findViewById(R.id.txt_go_date);
mTxtGoDate.setOnClickListener(this);
getDateGo();
mTxtGoDate.setText(mSearchParams.getGoDate().getDateAsString());

mTxtGoBackDate = (TextView) findViewById(R.id.txt_go_back_date);
mTxtGoBackDate.setOnClickListener(this);
getDateGoBack();
mTxtGoBackDate.setText(mSearchParams.getGoBackDate().getDateAsString());

mTxtCityWhere = (TextView) findViewById(R.id.txt_where_city);
mTxtCityWhere.setOnClickListener(this);
mTxtCityFrom = (TextView) findViewById(R.id.txt_from_city);
mTxtCityFrom.setOnClickListener(this);

mCheckOneWay = (CheckBox) findViewById(R.id.check_one_way);
mCheckOneWay.setOnCheckedChangeListener(this);
mCheckRange = (CheckBox) findViewById(R.id.check_correct);

mLayoutGoBack = (RelativeLayout) findViewById(R.id.layout_go_back);
((LinearLayout) findViewById(R.id.params_layout)).setOnClickListener(this);
mTxtManCount = (TextView) findViewById(R.id.param_man);
mTxtChildCount = (TextView) findViewById(R.id.param_child);
mTxtBabyCount = (TextView) findViewById(R.id.param_baby);
mTxtClass = (TextView) findViewById(R.id.param_class);

mBtnSearch = (Button) findViewById(R.id.btn_search_flightes);
mBtnSearch.setOnClickListener(this);

CitiesDataSource dbCities = new CitiesDataSource(this);
dbCities.open();
City from = dbCities.getLatestCity(true);
City where = dbCities.getLatestCity(false);
if (from != null) {
mTxtCityFrom.setText(from.getName());
mSearchParams.setFrom(from);
}
if (where != null) {
mTxtCityWhere.setText(where.getName());
mSearchParams.setWhere(where);
}
dbCities.close();
}

@Override
public void onResume() {
super.onResume(false);
}

父类(super class)中的 onResume:

protected void onResume(boolean flag) {
super.onResume();
}

其他代码与我的问题无关。谢谢

最佳答案

此 Activity 的 list 元素中是否有任何特殊标签,例如 configChanges 可能会使它选择资源的方式复杂化?

你也可以尝试将纵向布局放在默认目录中,并且只有横向布局的合格目录,即

layout/
//Your portrait (default) layout
layout-land/
//Your landscape layout overrides

关于android layout-land 和 layout-port 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12340426/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com