Search in sources :

Example 41 with RelativeLayout

use of android.widget.RelativeLayout in project MFCalendarView by MustafaFerhan.

the class MFCalendarView method init.

void init(Context context) {
    LayoutInflater li = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    view = li.inflate(R.layout.mf_calendarview, null, false);
    month = (GregorianCalendar) GregorianCalendar.getInstance();
    month.setTimeInMillis(Util.dateToLong(getInitialDate()));
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd", Util.getLocale());
    currentSelectedDate = df.format(month.getTime());
    calendaradapter = new CalendarAdapter(context, month);
    gridview = (ExpandableHeightGridView) view.findViewById(R.id.gridview);
    gridview.setAdapter(calendaradapter);
    handler = new Handler();
    handler.post(calendarUpdater);
    TextView title = (TextView) view.findViewById(R.id.title);
    title.setText(android.text.format.DateFormat.format("MMMM yyyy", month));
    RelativeLayout previous = (RelativeLayout) view.findViewById(R.id.previous);
    previous.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            setPreviousMonth();
            refreshCalendar();
        }
    });
    RelativeLayout next = (RelativeLayout) view.findViewById(R.id.next);
    next.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            setNextMonth();
            refreshCalendar();
        }
    });
    gridview.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            ((CalendarAdapter) parent.getAdapter()).setSelected(v);
            currentSelectedDate = CalendarAdapter.dayString.get(position);
            String[] separatedTime = currentSelectedDate.split("-");
            String gridvalueString = separatedTime[2].replaceFirst("^0*", // taking last part of date. ie; 2 from 2012-12-02.
            "");
            int gridvalue = Integer.parseInt(gridvalueString);
            // navigate to next or previous month on clicking offdays.
            if ((gridvalue > 10) && (position < 8)) {
                setPreviousMonth();
                refreshCalendar();
            } else if ((gridvalue < 15) && (position > 28)) {
                setNextMonth();
                refreshCalendar();
            }
            ((CalendarAdapter) parent.getAdapter()).setSelected(v);
            month.setTimeInMillis(Util.dateToLong(currentSelectedDate));
            calendaradapter.initCalendarAdapter(month, calendarListener);
            if (calendarListener != null)
                calendarListener.onDateChanged(currentSelectedDate);
        }
    });
    addView(view);
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Handler(android.os.Handler) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) LayoutInflater(android.view.LayoutInflater) RelativeLayout(android.widget.RelativeLayout) TextView(android.widget.TextView) SimpleDateFormat(java.text.SimpleDateFormat)

Example 42 with RelativeLayout

use of android.widget.RelativeLayout in project LuaViewSDK by alibaba.

the class Demo2Activity method test.

private void test() {
    mContainer = new RelativeLayout(this);
    mContainer.setBackgroundColor(Color.RED);
    mContainer.setAlpha(0.5f);
    child = new RelativeLayout(this);
    child.setBackgroundColor(Color.BLUE);
    child.setAlpha(0.5f);
    mContainer.addView(child, new ViewGroup.MarginLayoutParams(300, 300));
    ((ViewGroup.MarginLayoutParams) child.getLayoutParams()).leftMargin = 0;
    ((ViewGroup.MarginLayoutParams) child.getLayoutParams()).topMargin = 200;
    child.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            child.animate().translationY(-200).setDuration(2000).start();
        }
    });
    setContentView(mContainer, new ViewGroup.MarginLayoutParams(300, 300));
    ((ViewGroup.MarginLayoutParams) mContainer.getLayoutParams()).leftMargin = 200;
    ((ViewGroup.MarginLayoutParams) mContainer.getLayoutParams()).topMargin = 200;
}
Also used : ViewGroup(android.view.ViewGroup) RelativeLayout(android.widget.RelativeLayout) View(android.view.View)

Example 43 with RelativeLayout

use of android.widget.RelativeLayout in project Context-Menu.Android by Yalantis.

the class Utils method getImageWrapper.

public static RelativeLayout getImageWrapper(Context context, MenuObject menuItem, int menuItemSize, View.OnClickListener onCLick, View.OnLongClickListener onLongClick, boolean showDivider) {
    RelativeLayout imageWrapper = new RelativeLayout(context);
    LinearLayout.LayoutParams imageWrapperLayoutParams = new LinearLayout.LayoutParams(menuItemSize, menuItemSize);
    imageWrapper.setLayoutParams(imageWrapperLayoutParams);
    imageWrapper.setOnClickListener(onCLick);
    imageWrapper.setOnLongClickListener(onLongClick);
    imageWrapper.addView(Utils.getItemImageButton(context, menuItem));
    if (showDivider) {
        imageWrapper.addView(getDivider(context, menuItem));
    }
    if (menuItem.getBgColor() != 0) {
        imageWrapper.setBackgroundColor(menuItem.getBgColor());
    } else if (menuItem.getBgDrawable() != null) {
        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
            imageWrapper.setBackgroundDrawable(menuItem.getBgDrawable());
        } else {
            imageWrapper.setBackground(menuItem.getBgDrawable());
        }
    } else if (menuItem.getBgResource() != 0) {
        imageWrapper.setBackgroundResource(menuItem.getBgResource());
    } else {
        imageWrapper.setBackgroundColor(context.getResources().getColor(R.color.menu_item_background));
    }
    return imageWrapper;
}
Also used : RelativeLayout(android.widget.RelativeLayout) LinearLayout(android.widget.LinearLayout)

Example 44 with RelativeLayout

use of android.widget.RelativeLayout in project remusic by aa112901.

the class SplashActivity method setupSplashAd.

/**
	 * 设置开屏广告
	 */
private void setupSplashAd() {
    // 创建开屏容器
    final RelativeLayout splashLayout = (RelativeLayout) findViewById(R.id.rl_splash);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    params.addRule(RelativeLayout.ABOVE, R.id.view_divider);
    // 对开屏进行设置
    SplashViewSettings splashViewSettings = new SplashViewSettings();
    //		// 设置是否展示失败自动跳转,默认自动跳转
    //		splashViewSettings.setAutoJumpToTargetWhenShowFailed(false);
    // 设置跳转的窗口类
    splashViewSettings.setTargetClass(MainActivity.class);
    // 设置开屏的容器
    splashViewSettings.setSplashViewContainer(splashLayout);
    // 展示开屏广告
    SpotManager.getInstance(mContext).showSplash(mContext, splashViewSettings, mStopListener);
}
Also used : RelativeLayout(android.widget.RelativeLayout) SplashViewSettings(net.youmi.android.normal.spot.SplashViewSettings)

Example 45 with RelativeLayout

use of android.widget.RelativeLayout in project remusic by aa112901.

the class SwipeRefreshLayout method createFooterViewContainer.

/**
     * 添加底部布局
     */
private void createFooterViewContainer() {
    mFooterViewContainer = new RelativeLayout(getContext());
    mFooterViewContainer.setVisibility(View.GONE);
    addView(mFooterViewContainer);
}
Also used : RelativeLayout(android.widget.RelativeLayout)

Aggregations

RelativeLayout (android.widget.RelativeLayout)201 TextView (android.widget.TextView)89 View (android.view.View)84 ImageView (android.widget.ImageView)51 LinearLayout (android.widget.LinearLayout)37 ViewGroup (android.view.ViewGroup)32 ScrollView (android.widget.ScrollView)16 Intent (android.content.Intent)14 OnClickListener (android.view.View.OnClickListener)14 FrameLayout (android.widget.FrameLayout)13 SuppressLint (android.annotation.SuppressLint)12 LayoutInflater (android.view.LayoutInflater)12 ListView (android.widget.ListView)12 ImageButton (android.widget.ImageButton)11 Resources (android.content.res.Resources)10 Bundle (android.os.Bundle)10 Button (android.widget.Button)10 DialogInterface (android.content.DialogInterface)9 DisplayMetrics (android.util.DisplayMetrics)8 Builder (android.app.AlertDialog.Builder)7