Если вы хотите, чтобы показать его как всплывающие окна вы можете сделать пользовательский диалог https://developer.android.com/guide/topics/ui/dialogs.html Но если вы хотите сделать HorizontalScrollView невидимым и сделать его видимым на заголовке щелчком мыши вы можете установить в XML android:visibility="invisible"
или android:visibility="gone"
, а затем в java click listener horizontalScrollView.setVisibility(View.VISIBLE);
Чтобы сделать это всплывающим/слайд вниз по заголовку, вам нужно будет использовать анимацию для Android. Вот как я бы сделал это, основываясь на этом коде https://gist.github.com/rafali/5146957:
MainActivity.class
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final HorizontalScrollView hsc = (HorizontalScrollView) findViewById(R.id.daily_use_items);
TextView tv = (TextView) findViewById(R.id.header);
hsc.setAlpha(0.0f);
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
hsc.animate().alpha(1.0f);
ResizeAnimation resizeAnimation = new ResizeAnimation(hsc,hsc.getHeight());
resizeAnimation.setDuration(600);
hsc.startAnimation(resizeAnimation);
}
});
}
}
ResizeAnimation.class
public class ResizeAnimation extends Animation {
final int startHeight;
final int targetHeight;
View view;
public ResizeAnimation(View view, int targetHeight) {
this.view = view;
this.targetHeight = targetHeight;
startHeight = 0;
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
int newHeight = (int) (startHeight + (targetHeight - startHeight) * interpolatedTime);
view.getLayoutParams().height = newHeight;
view.requestLayout();
}
@Override
public void initialize(int width, int height, int parentWidth, int parentHeight) {
super.initialize(width, height, parentWidth, parentHeight);
}
@Override
public boolean willChangeBounds() {
return true;
}
}
Разместите код! – OBX