나는 안드로이드 개발을 처음 접하고 다른 프로젝트에서 XML 레이아웃을 복사하려고 시도했지만 그 그래픽 레이아웃은 내가 얻고있는 것과는 다른 것으로 보인다. 나는 내 프로젝트에서 내가 같은 레이아웃을 얻지 못하고 있다는 것을 모른다. 도와주세요.동일한 XML 코드, 다른 그래픽 레이아웃
이 모양은 다음과 같습니다.
! 1
이 코드는 정확한 코드를 복사 한 후 가져옵니다.
! 2
내 xml 파일
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.aditya.contentsharer"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".InteriorSpottingApplication"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".InteriorListActivity"
android:label="@string/title_activity_interior_list" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="android.app.Activity" />
</activity>
<activity
android:name=".NewInteriorActivity"
android:label="@string/title_activity_new_interior" >
</activity>
</application>
</manifest>
XML 코드
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
자바 코드
package com.aditya.contentsharer;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import com.parse.ParseQueryAdapter;
public class InteriorListActivity extends ListActivity{
private ParseQueryAdapter<Interior> mainAdapter;
private FavoriteInteriorAdapter favoritesAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getListView().setClickable(false);
mainAdapter = new ParseQueryAdapter<Interior>(this, Interior.class);
mainAdapter.setTextKey("title");
mainAdapter.setImageKey("photo");
// Subclass of ParseQueryAdapter
favoritesAdapter = new FavoriteInteriorAdapter(this);
// Default view is all interiors
setListAdapter(mainAdapter);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_interior_list, menu);
return true;
}
/*
* Posting interiors and refreshing the list will be controlled from the Action
* Bar.
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_refresh: {
updateinteriorList();
break;
}
case R.id.action_favorites: {
showFavorites();
break;
}
case R.id.action_new: {
newinterior();
break;
}
}
return super.onOptionsItemSelected(item);
}
private void updateinteriorList() {
mainAdapter.loadObjects();
setListAdapter(mainAdapter);
}
private void showFavorites() {
favoritesAdapter.loadObjects();
setListAdapter(favoritesAdapter);
}
private void newinterior() {
Intent i = new Intent(this, NewInteriorActivity.class);
startActivityForResult(i, 0);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
// If a new post has been added, update
// the list of posts
updateinteriorList();
}
}
}
맨 위에 해당 작업 표시 줄을 표시해야합니다. –
레이아웃에서 holo.light 테마를 사용하여 작업 표시 줄을 가져올 수 있었지만 장치에서 실행할 때 여전히 표시되지 않습니다. –