1
한 줄에 2 개의 이미지를 격자 형식으로 표시하고 싶습니다. Android Query에서 어떻게합니까? 기존로서는 ... 충분하고 적절한 문서 부족Android 검색어 : 격자 표시 (이미지)
activity_identify_animals.xml :
<ProgressBar
android:layout_width="15dip"
android:layout_height="15dip"
android:id="@+id/progress"
android:layout_centerInParent="true"
/>
<ImageView
android:id="@+id/image"
android:layout_width="fill_parent"
android:layout_height="75dip"
/>
IdentifyAnimals.java :
package uk.ac.gla.serengeti.activities;
import com.androidquery.AQuery;
import uk.ac.gla.serengeti.R;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.annotation.TargetApi;
import android.os.Build;
public class IdentifyAnimals extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_identify_animals);
AQuery aq = new AQuery(this);
aq.id(R.id.image).progress(R.id.progress).image("http://www.ibeta.eu/blog/wp-content/uploads/2012/02/darthvader-design.jpg");
aq.id(R.id.image).progress(R.id.progress).image("http://www.geekome.com/wp-content/uploads/2013/09/anakin-skywalker-voice-as-darth-vader.jpeg");
aq.id(R.id.image).progress(R.id.progress).image("http://www.camelcitydispatch.com/wp-content/uploads/2013/01/Darth-Vader-liking-villans-more-than-heroes-31394364-1280-960.jpg");
aq.id(R.id.image).progress(R.id.progress).image("http://www.geekbinge.com/wp-content/uploads/2013/08/Darth-Vader-Star-Wars.jpg");
aq.id(R.id.image).progress(R.id.progress).image("http://static1.wikia.nocookie.net/__cb20111223224559/starwars/images/b/b0/DarthVader-CotF.jpg");
aq.id(R.id.image).progress(R.id.progress).image("http://www.wallsave.com/wallpapers/1920x1200/darth-vader/460382/darth-vader-hd-free-for-460382.jpg");
}
/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.identify_animals, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of this
// activity, the Up button is shown. Use NavUtils to allow users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
// http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
//NavUtils.navigateUpFromSameTask(this);
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
참조 : http://code.google.com/p/android-query/
012,351,
감사합니다. 문자열 배열 등의 이미지를 동적으로 표시하는 방법에 대한 코드를 제공 할 수 있습니까? – chuckfinley
예. 업데이트 된 답변을 확인하십시오. – VikramV
ImageListAdapter 클래스를 만들었습니다. 그리드를 어떻게 채울 수 있습니까? 죄송합니다. Android 개발에서 완전히 새로운 것 같습니다. – chuckfinley