我正在根据这个例子开发一个应用程序。我在 layout-land 文件夹中为 header.xml 定义了横向布局,但是当我将方向更改为横向时,定义的布局不会出现在屏幕中。
知道为什么吗?
谢谢
更新 :
活动代码:
public class ACENewsFeedActivity extends ListActivity {
// Progress Dialog
private ProgressDialog pDialog;
// Array list for list view
ArrayList<HashMap<String, String>> rssItemList = new ArrayList<HashMap<String,String>>();
RSSParser rssParser = new RSSParser();
List<RSSItem> rssItems = new ArrayList<RSSItem>();
RssFeed rssFeed;
private static String TAG_TITLE = "title";
private static String TAG_LINK = "link";
private static String TAG_DESRIPTION = "description";
private static String TAG_PUB_DATE = "pubDate";
//private static String TAG_GUID = "guid"; // not used
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.rss_item_list);
/**
* Calling a backgroung thread will loads recent articles of a website
* @param rss url of website
* */
new loadRSSFeedItems().execute();
}
....
}
横向模式下的 XML 布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layoutHeader"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:layout_alignParentTop="true"
android:background="@layout/header_gradient"
android:orientation="horizontal">
<!-- Logo -->
<!-- Refresh -->
<!-- Plus Button -->
<ImageButton
android:id="@+id/btnAddSite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="5dip"
android:background="@null"
android:src="@drawable/plus"
android:layout_centerVertical="true" />
<ImageView
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@drawable/logo" />
<ImageView
android:id="@+id/refreshList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="@drawable/refresh" />
</RelativeLayout>