當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewCompat.setLayoutDirection方法代碼示例

本文整理匯總了Java中android.support.v4.view.ViewCompat.setLayoutDirection方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewCompat.setLayoutDirection方法的具體用法?Java ViewCompat.setLayoutDirection怎麽用?Java ViewCompat.setLayoutDirection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.view.ViewCompat的用法示例。


在下文中一共展示了ViewCompat.setLayoutDirection方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: putLayoutDirectionIntoMap

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private static void putLayoutDirectionIntoMap(AmazonWebView webView, Map<String, String> substitutionMap) {
    ViewCompat.setLayoutDirection(webView, View.LAYOUT_DIRECTION_LOCALE);
    final int layoutDirection = ViewCompat.getLayoutDirection(webView);

    final String direction;

    if (layoutDirection == View.LAYOUT_DIRECTION_LTR) {
        direction = "ltr";
    } else if (layoutDirection == View.LAYOUT_DIRECTION_RTL) {
        direction = "rtl";
    } else {
        direction = "auto";
    }

    substitutionMap.put("%dir%", direction);
}
 
開發者ID:mozilla-mobile,項目名稱:firefox-tv,代碼行數:17,代碼來源:LocalizedContent.java

示例2: initScrollView

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void initScrollView(){
    mScrollView = new InternalScrollView(getContext());
    mScrollView.setPadding(0, 0, 0, mContentPadding - mActionPadding_h);
    mScrollView.setClipToPadding(false);
    mScrollView.setFillViewport(true);
    mScrollView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
    ViewCompat.setLayoutDirection(mScrollView, View.LAYOUT_DIRECTION_INHERIT);
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:9,代碼來源:SimpleDialog.java

示例3: initListView

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void initListView(){
    mListView = new InternalListView(getContext());
    mListView.setDividerHeight(0);
    mListView.setCacheColorHint(0x00000000);
    mListView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
    mListView.setClipToPadding(false);
    mListView.setSelector(BlankDrawable.getInstance());
    mListView.setPadding(0, 0, 0, mContentPadding - mActionPadding_h);
    mListView.setVerticalFadingEdgeEnabled(false);
    mListView.setOverScrollMode(ListView.OVER_SCROLL_NEVER);
    ViewCompat.setLayoutDirection(mListView, ViewCompat.LAYOUT_DIRECTION_INHERIT);

    mAdapter = new InternalAdapter();
    mListView.setAdapter(mAdapter);
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:16,代碼來源:SimpleDialog.java

示例4: correctDiretion

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
public void correctDiretion()
{
    boolean numIsRtl=true;
    if (ViewCompat.getLayoutDirection(this) != View.LAYOUT_DIRECTION_RTL) {
        numIsRtl = false;
    }
    ViewCompat.setLayoutDirection(this, View.LAYOUT_DIRECTION_LTR);
    this.setGravity(numIsRtl ? Gravity.LEFT : Gravity.RIGHT);

}
 
開發者ID:fekracomputers,項目名稱:IslamicLibraryAndroid,代碼行數:11,代碼來源:KeyboardAwareEditText.java

示例5: getLayoutManager

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
@UiThread
@Override
protected ChipsLayoutManager getLayoutManager() {
    ChipsLayoutManager layoutManager = super.getLayoutManager();
    if (activityTestRule.getActivity() != null) {
        View recyclerView = activityTestRule.getActivity().findViewById(R.id.rvTest);
        ViewCompat.setLayoutDirection(recyclerView, ViewCompat.LAYOUT_DIRECTION_RTL);
    }
    return layoutManager;
}
 
開發者ID:sathishmscict,項目名稱:ChipsLayoutManager,代碼行數:11,代碼來源:RTLRowTest.java

示例6: setupLayoutDirection

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
public void setupLayoutDirection() {
    ViewCompat.setLayoutDirection(getWindow().getDecorView(), ViewCompat.LAYOUT_DIRECTION_LTR);
    // previous way of setting layout direction, the new one works below API 17 so that's good
    // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    //     getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
    // }
}
 
開發者ID:kfaryarok,項目名稱:kfaryarok-android,代碼行數:8,代碼來源:MainActivity.java

示例7: setLayoutDirection

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
/**
 * Force set layout direction to RTL or LTR by Locale.
 *
 * @param view
 * @param locale
 */
public static void setLayoutDirection(View view, Locale locale) {
    switch (TextUtilsCompat.getLayoutDirectionFromLocale(locale)) {
        case ViewCompat.LAYOUT_DIRECTION_RTL:
            ViewCompat.setLayoutDirection(view, ViewCompat.LAYOUT_DIRECTION_RTL);
            break;
        case ViewCompat.LAYOUT_DIRECTION_LTR:
        default:
            ViewCompat.setLayoutDirection(view, ViewCompat.LAYOUT_DIRECTION_LTR);
            break;
    }
}
 
開發者ID:mozilla-mobile,項目名稱:firefox-tv,代碼行數:18,代碼來源:LocaleAwareAppCompatActivity.java

示例8: onCreateView

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    final View view = super.onCreateView(inflater, container, savedInstanceState);
    // For correct display in RTL locales, we need to set the layout direction of the
    // fragment's top view.
    ViewCompat.setLayoutDirection(view, ViewCompat.LAYOUT_DIRECTION_LOCALE);
    return view;
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:10,代碼來源:CustomInputStyleSettingsFragment.java

示例9: setLayoutDirection

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
public void setLayoutDirection(final boolean isRtlLanguage) {
    final int layoutDirection = isRtlLanguage ? ViewCompat.LAYOUT_DIRECTION_RTL
            : ViewCompat.LAYOUT_DIRECTION_LTR;
    ViewCompat.setLayoutDirection(mSuggestionStripView, layoutDirection);
    ViewCompat.setLayoutDirection(mSuggestionsStrip, layoutDirection);
    ViewCompat.setLayoutDirection(mImportantNoticeStrip, layoutDirection);
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:8,代碼來源:SuggestionStripView.java

示例10: onCreate

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    ButterKnife.bind(this);

    ViewCompat.setLayoutDirection(getWindow().getDecorView(), ViewCompat.LAYOUT_DIRECTION_RTL);

    final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());

    // cache current devmode state
    developerModeActive = prefs.getBoolean(getString(R.string.pref_advanced_mode_bool), false);

    if (developerModeActive) {
        // show button if devmode is enabled already, as a way to disable it
        btnEasterEgg.setBackgroundResource(android.R.drawable.btn_default);
    } else {
        btnEasterEgg.setText("");
    }

    btnEasterEgg.setOnClickListener(v -> {
        if (!developerModeActive) {
            // only if devmode isn't enabled
            if (easterEggClickCounter == clickCounterMax) {
                // update prefs
                prefs.edit().putBoolean(getString(R.string.pref_advanced_mode_bool), developerModeActive = true).apply();

                // alert user
                if (toast != null) {
                    toast.cancel();
                }
                toast = Toast.makeText(getApplicationContext(), getString(R.string.toast_devmode_enabled), Toast.LENGTH_LONG);
                toast.show();

                btnEasterEgg.setBackgroundResource(android.R.drawable.btn_default);
                btnEasterEgg.setText(getString(R.string.btn_devmode_easteregg));
            } else {
                // increase count
                easterEggClickCounter++;

                if (easterEggClickCounter >= 4) {
                    if (toast != null) {
                        toast.cancel();
                    }
                    // the extra space is because android removes spaces from strings
                    toast = Toast.makeText(getApplicationContext(),
                            (clickCounterMax - easterEggClickCounter + 1) + " " +
                                    getString(R.string.toast_devmode_clicks_remaining),
                            Toast.LENGTH_LONG);
                    toast.show();
                }
            }
        } else {
            prefs.edit().putBoolean(getString(R.string.pref_advanced_mode_bool), developerModeActive = false).apply();
            btnEasterEgg.setBackgroundResource(android.R.color.transparent);
            btnEasterEgg.setText("");
            easterEggClickCounter = 0;

            if (toast != null) {
                toast.cancel();
            }
            toast = Toast.makeText(getApplicationContext(), getString(R.string.toast_devmode_disabled), Toast.LENGTH_LONG);
            toast.show();
        }
    });
}
 
開發者ID:kfaryarok,項目名稱:kfaryarok-android,代碼行數:67,代碼來源:AboutActivity.java

示例11: layoutDirection

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
/**
 * Set the layout direction of this Dialog
 * @param direction The layout direction value. Can be {@link View#LAYOUT_DIRECTION_LTR}, {@link View#LAYOUT_DIRECTION_RTL} or {@link View#LAYOUT_DIRECTION_LOCALE}
 * @return The Dialog for chaining methods.
 */
public Dialog layoutDirection(int direction){
    ViewCompat.setLayoutDirection(mCardView, direction);
    return this;
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:10,代碼來源:Dialog.java


注:本文中的android.support.v4.view.ViewCompat.setLayoutDirection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。