可以ListView横向制作吗?我这样做了使用图库视图,但所选项目自动进入屏幕中心.我不希望所选项目在我点击的同一位置.我该如何纠正这个问题?我的想法是设置ListView水平滚动.分享你的想法?
我知道在Android中不可能水平滚动网格视图.但我正在做的是在水平滚动视图中动态添加图像按钮,如下所示:
public class HorizontalScroller extends Activity {
static int l=0;
private Rect mTempRect = new Rect();
static int r1=0;
static int t=0;
static int b=0;
static int x=0;
static int y=0;
//Button[] b1 = new Button[100];
ImageButton btn[][] = new ImageButton[10][10];
//ImageButton b1 = new ImageButton(this);
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LinearLayout rl = (LinearLayout)findViewById(R.id.widget92);
LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
for(int i=0;i<4;i++)
{
for(int j=0;j<10;j++)
{System.out.println("helo");
/* l=l+100; …Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一个水平滚动网格.它有两行.第二行是偏移的(一个项目的宽度的一半,但这是微不足道的计算,这里无关紧要).
我目前使用RecyclerView和GridLayoutManager从https://github.com/antoniolg/RecyclerViewExtensions/tree/master/library/src/main/java/com/antonioleiva/recyclerviewextensions
然而,抵消证明是非常困难的.
它应该看起来像 
有没有人建议让第二行如上图所示错开?