我动态地向a添加项目,ListView并希望使所有项目始终可见,而无需滚动.
布局代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/recipe_inside"
android:orientation="vertical" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="16dp"
android:src="@drawable/head_cella" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="41dp"
android:background="@drawable/body_cella"
android:gravity="center_horizontal"
android:paddingTop="5dp"
android:text="Remember to save before leaving this page or inserted/modified data will be lost."
android:textColor="#000000"
android:textSize="13dp" />
<ImageView
android:id="@+id/ImageView01"
android:layout_width="match_parent"
android:layout_height="16dp"
android:layout_marginTop="30dp"
android:src="@drawable/head_cella" />
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:background="@drawable/body_cella"
android:gravity="center_horizontal"
android:paddingTop="10dp"
android:text="Category"
android:textColor="#000000"
android:textSize="15dp" />
<Spinner
android:id="@+id/category_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/ImageView02"
android:layout_width="match_parent"
android:layout_height="16dp"
android:layout_marginTop="30dp"
android:src="@drawable/head_cella" /> …Run Code Online (Sandbox Code Playgroud) 我正在尝试获取Youtube要在我的屏幕上显示的视频列表Activity.我MediaActivity.java用两个方法创建了主活动,onCreate并getResult从类中的onPostExecute方法调用AsyncTask.这是MediaActivity代码:
public class MediaActivity extends Activity {
YoutubeConnect youtubeRequest = new YoutubeConnect();
ViewGroup media;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
youtubeRequest.execute();
setContentView(R.layout.media);
media = (ViewGroup) this.findViewById(R.layout.media);
}
public void getResult(String result) throws JSONException {
JSONObject jsonObj = new JSONObject(result);
JSONObject jsonObj2 = jsonObj.getJSONObject("feed");
JSONArray the_json_array = jsonObj2.getJSONArray("entry");
int size = the_json_array.length();
for (int i = 0; i < size; i++) {
//get all …Run Code Online (Sandbox Code Playgroud)