我只是對我的佈局有點問題。在這裏它是:android:layout_below保持重疊視圖
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/Beige"
tools:context=".HomeActivity" >
<TextView
android:id="@+id/strip_popular"
style="@style/StripsHome"
android:layout_width="match_parent"
android:text="@string/home_popular" >
</TextView>
<HorizontalScrollView
android:id="@+id/scroll_popular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/strip_popular" >
<LinearLayout
android:id="@+id/popular_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
<TextView
android:id="@+id/strip_latestreviews"
style="@style/StripsHome"
android:layout_width="match_parent"
android:layout_below="@id/strip_popular"
android:text="@string/home_latestreviews">
</TextView>
<HorizontalScrollView
android:id="@+id/scroll_latestreviews"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/strip_latestreviews" >
<LinearLayout
android:id="@+id/latestreviews_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
我的問題是,第二TextView的完全重疊,而不是出現在水平滾動視圖下方的第一個,。
在我的代碼中插入這樣的圖像:
LinearLayout popular = (LinearLayout) findViewById(R.id.popular_layout);
Integer[] mThumbIds = {
R.drawable.first, R.drawable.second,
R.drawable.third, R.drawable.fourth};
for(Integer i : mThumbIds){
ImageView imageView = new ImageView(getApplicationContext());
imageView.setLayoutParams(new LinearLayout.LayoutParams(220, 220));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setImageResource(i);
popular.addView(imageView);
}
什麼建議嗎?
你的android:layout_below = 「@ ID/strip_popular」 在滾動視圖和TextView的。 – Nfear